Subversion Repositories Kolibri OS

Rev

Rev 3175 | Rev 6238 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;Ž£à®¬­ ï ¡« £®¤ à­®áâì Maxxxx32, Diamond, Heavyiron
  2. ;¨ ¤à㣨¬ ¯à®£à ¬¬¨áâ ¬,   â ª¦¥
  3. ;’¥¯«®¢ã €«¥ªá¥î (<Lrz> www.lrz.land.ru)
  4. use32
  5.   org 0x0
  6.   db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
  7.   dd 0x1
  8.   dd start
  9.   dd i_end ; à §¬¥à ¯à¨«®¦¥­¨ï
  10.   dd mem
  11.   dd stacktop
  12.   dd 0x0
  13.   dd sys_path
  14.  
  15. include '../../proc32.inc'
  16. include '../../macros.inc'
  17. include '../../dll.inc'
  18.  
  19. include '../../develop/libraries/box_lib/load_lib.mac'
  20. include '../../develop/libraries/box_lib/trunk/box_lib.mac'
  21.  
  22. min_window_w equ 485 ;¬¨­¨¬ «ì­ ï è¨à¨­  ®ª­ 
  23. min_window_h equ 325 ;¬¨­¨¬ «ì­ ï ¢ëá®â  ®ª­ 
  24. otst_panel_left equ 265
  25.  
  26. include 'tile_fun.inc'
  27. include 'pl_import.inc'
  28.  
  29.   @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc, dll.Load
  30.  
  31. struct FileInfoBlock
  32.         Function dd ?
  33.         Position dd ?
  34.         Flags    dd ?
  35.         Count    dd ?
  36.         Buffer   dd ?
  37.                 db ?
  38.         FileName dd ?
  39. ends
  40.  
  41. fn_metki db 'pl_metki.lst',0
  42. fn_icon1 db 'tl_sys_16.png',0
  43. fn_icon2 db 'tl_nod_16.bmp',0
  44.  
  45. ini_name db 'planet_v.ini',0
  46. ini_sec  db 'Map',0
  47. ini_k_cache db 'Cache',0
  48. ini_def_cache db '/cache/sat',0
  49. ini_ext  db 'ext'
  50. .number  db '?'
  51. .def db 0 ;à áè¨à¥­¨¥ ¯® 㬮«ç ­¨î
  52.  
  53.  
  54. align 4
  55. start:
  56.   load_libraries l_libs_start,load_lib_end
  57.  
  58. ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨«¨áì ¡¨¡«¨®â¥ª¨
  59.         cmp     dword [lib0+ll_struc_size-4],0
  60.         jnz @f
  61.         cmp     dword [lib1+ll_struc_size-4],0
  62.         jnz @f
  63.         cmp     dword [lib2+ll_struc_size-4],0
  64.         jnz @f
  65.         cmp     dword [lib3+ll_struc_size-4],0
  66.         jnz @f
  67.         jmp .lib
  68.         @@:
  69.                 mcall -1 ;exit not correct
  70.         .lib:
  71.  
  72.   copy_path ini_name,sys_path,file_name,0
  73.   stdcall dword[ini_get_str],file_name,ini_sec,ini_k_cache,dword[edit1.text],dword[edit1.max],ini_def_cache
  74.   stdcall [str_len],dword[edit1.text],dword[edit1.max]
  75.   mov dword[edit1.size],eax
  76.   mov dword[edit1.pos],eax
  77.  
  78.   stdcall dword[tl_data_init], tree1
  79.   stdcall dword[tl_data_init], tree2
  80.  
  81. ;áç¨â뢠¥¬ à áè¨à¥­¨ï ª àâ ¨§ *.ini ä ©« 
  82.   mov byte[ini_ext.number],'0'
  83. @@: ;áç¨â뢠¥¬ ¯ à ¬¥âàë ®â ext1 ¤® ext9
  84.   inc byte[ini_ext.number]
  85.   stdcall dword[ini_get_str],file_name,ini_sec,ini_ext,txt_tile_type_0,dword[tree1.info_capt_len],ini_ext.def
  86.   cmp byte[txt_tile_type_0],0
  87.   je @f
  88.     stdcall dword[tl_node_add], tree1, 0, txt_tile_type_0
  89.   jmp @b
  90. @@:
  91.   mov byte[ini_ext.number],'0' ;áç¨â뢠¥¬ ¯ à ¬¥âà ®â ext0 ª®â®àë© ¡ã¤¥â ¢ë¡à ­ ¢ ᯨ᪥
  92.   stdcall dword[ini_get_str],file_name,ini_sec,ini_ext,txt_tile_type_0,dword[tree1.info_capt_len],ini_ext.def
  93.   cmp byte[txt_tile_type_0],0
  94.   jne @f
  95.     mov dword[txt_tile_type_0],'.bmp' ;¥á«¨ ¢ *.ini ä ©«¥ ­¨ç¥£® ­¥â ¤®¡ ¢«ï¥¬ à áè¨à¥­¨¥ .bmp
  96.   @@:
  97.   stdcall dword[tl_node_add], tree1, 0, txt_tile_type_0
  98.  
  99. ; init bmp file
  100.   stdcall mem.Alloc, dword RGB_TILE_SIZE+300 ;300 - § ¯ á­ë¥ ¡ ©âë á ãç¥â®¬ § £®«®¢ª  bmp ä ©« 
  101.   mov [bmp_icon],eax
  102.  
  103.   stdcall array_tile_function, tile_00,max_tiles_count,tile_init
  104.   stdcall tiles_init_grid, tile_00,max_tiles_count,max_tiles_cols
  105.  
  106.   stdcall mem.Alloc, dword TREE_ICON_SYS16_BMP_SIZE
  107.   mov [tree_sys_icon],eax
  108.  
  109.   stdcall mem.Alloc, dword TREE_ICON_NOD16_BMP_SIZE
  110.   mov [tree_nod_icon],eax
  111.  
  112.   copy_path fn_icon1,sys_path,file_name,0
  113.   mov [run_file_70.Function], 0
  114.   mov [run_file_70.Position], 0
  115.   mov [run_file_70.Flags], 0
  116.   mov [run_file_70.Count], TREE_ICON_SYS16_BMP_SIZE
  117.   m2m [run_file_70.Buffer], [tree_sys_icon]
  118.   mov byte[run_file_70+20], 0
  119.   mov [run_file_70.FileName], file_name
  120.   mcall 70,run_file_70
  121.   cmp ebx,0xffffffff
  122.   je @f
  123.     stdcall dword[img_decode], dword[tree_sys_icon],ebx,0
  124.     mov dword[data_icon],eax
  125.     stdcall dword[img_to_rgb2], dword[data_icon],dword[tree_sys_icon]
  126.     stdcall dword[img_destroy], dword[data_icon]
  127.  
  128.     m2m dword[tree1.data_img_sys],dword[tree_sys_icon]
  129.     m2m dword[tree2.data_img_sys],dword[tree_sys_icon]
  130.   @@:
  131.  
  132.  
  133.   copy_path fn_icon2,sys_path,file_name,0
  134.   mov [run_file_70.Count], TREE_ICON_NOD16_BMP_SIZE
  135.   m2m [run_file_70.Buffer], [tree_nod_icon]
  136.   mcall 70,run_file_70
  137.   cmp ebx,0xffffffff
  138.   je @f
  139.     stdcall dword[img_decode], dword[tree_nod_icon],ebx,0
  140.     mov dword[data_icon],eax
  141.     stdcall dword[img_to_rgb2], dword[data_icon],dword[tree_nod_icon]
  142.     stdcall dword[img_destroy], dword[data_icon]
  143.  
  144.     m2m dword[tree1.data_img],dword[tree_nod_icon]
  145.     m2m dword[tree2.data_img],dword[tree_nod_icon]
  146.   @@:
  147.  
  148.   mcall 40,0x27 ;¬ áª  á¨á⥬­ëå ᮡë⨩
  149.   init_checkboxes2 ch1,checkboxes_end
  150.  
  151.   mcall 48,3,sc,sizeof.system_colors
  152.   ;ãáâ ­®¢ª  á¨á⥬­ëå 梥⮢
  153.   edit_boxes_set_sys_color edit1,editboxes_end,sc
  154.   check_boxes_set_sys_color2 ch1,checkboxes_end,sc
  155.  
  156.   mov byte[file_name],0
  157.  
  158.   ; OpenDialog initialisation
  159.   stdcall [OpenDialog_Init],OpenDialog_data
  160.  
  161. align 4
  162. red_win:
  163.         call draw_window
  164.         call but_MetLoad
  165.         call but_Refresh ; Auto Refresh after program start
  166.  
  167. align 4
  168. still:
  169.         mcall 10
  170.  
  171.         cmp al,0x1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
  172.         jz red_win
  173.         cmp al,0x2
  174.         jz key
  175.         cmp al,0x3
  176.         jz button
  177.  
  178.         stdcall [check_box_mouse],ch2
  179.         stdcall [check_box_mouse],ch1
  180.         stdcall [edit_box_mouse], edit1
  181.         stdcall [edit_box_mouse], edit2
  182.         stdcall [tl_mouse], tree1
  183.         stdcall [tl_mouse], tree2
  184.  
  185.         jmp still
  186.  
  187. align 4
  188. key:
  189.         push eax ebx
  190.         mcall 2
  191.         stdcall [edit_box_key], edit1
  192.         stdcall [edit_box_key], edit2
  193.  
  194.         stdcall [tl_key],tree1
  195.         stdcall [tl_key],tree2
  196.  
  197.         mov ebx,dword[el_focus] ;çâ®-¡ë ª àâ  ­¥ ¤¢¨£ « áì ¥á«¨ ®ª­  treelist ¢ 䮪ãá¥
  198.         cmp ebx, dword tree1
  199.         je .end_f
  200.         cmp ebx, dword tree2
  201.         je .end_f
  202.  
  203.         ;çâ®-¡ë ª àâ  ­¥ ¤¢¨£ « áì ¥á«¨ ⥪áâ®¢ë¥ ¯®«ï ¢ 䮪ãá¥
  204.         test word[edit1.flags],10b ;ed_focus
  205.         jne .end_f
  206.         test word[edit2.flags],10b ;ed_focus
  207.         jne .end_f
  208.  
  209.     cmp ah,179 ;Right
  210.     jne @f
  211.       call CursorMoveRight
  212.     @@:
  213.     cmp ah,176 ;Left
  214.     jne @f
  215.     cmp dword[map.coord_x],0
  216.     je @f
  217.       dec dword[map.coord_x]
  218.       ;ᤢ¨£ ¥¬ á¥âªã â ©«®¢ ¢¯à ¢®, çâ®-¡ë ç áâì â ©«®¢ ᮢ¯ «¨ ¨ ¯à¨è«®áì ¬¥­ìè¥ § £à㦠âì ­®¢ëå
  219.       stdcall tiles_grid_move_right, tile_00,max_tiles_count,max_tiles_cols
  220.       call but_Refresh
  221.     @@:
  222.     cmp ah,177 ;Down
  223.     jne @f
  224.       call CursorMoveDown
  225.     @@:
  226.     cmp ah,178 ;Up
  227.     jne @f
  228.     cmp dword[map.coord_y],0
  229.     je @f
  230.       dec dword[map.coord_y]
  231.       ;ᤢ¨£ ¥¬ á¥âªã â ©«®¢ ¢­¨§
  232.       stdcall tiles_grid_move_down, tile_00,max_tiles_count,max_tiles_rows
  233.       call but_Refresh
  234.     @@:
  235.  
  236.     cmp ah,45 ;-
  237.     jne @f
  238.       call but_ZoomM
  239.     @@:
  240.     cmp ah,61 ;+
  241.     jne @f
  242.       call but_ZoomP
  243.     @@:
  244.  
  245.         .end_f:
  246.         pop ebx eax
  247.         jmp still
  248.  
  249.  
  250. align 4
  251. draw_window:
  252. pushad
  253.   mcall 12,1
  254.  
  255.   xor eax,eax
  256.   mov edx,[sc.work]
  257.   or  edx,0x33000000
  258.   mov edi,hed
  259.   mcall ,20*65536+min_window_w,20*65536+min_window_h
  260.  
  261.   mcall 9,procinfo,-1
  262.  
  263.   cmp dword[procinfo.box.width],min_window_w ; ¯à®¢¥à塞 è¨à¨­ã ®ª­ 
  264.   jge @f
  265.     mov dword[procinfo.box.width],min_window_w ; ¥á«¨ ®ª­® ®ç¥­ì 㧪®¥, 㢥«¨ç¨¢ ¥¬ è¨à¨­ã ¤«ï ¨§¡¥¦ ­¨ï £«îª®¢
  266.   @@:
  267.  
  268.   mov edi,dword[procinfo.box.width]
  269.   sub edi,min_window_w-otst_panel_left
  270.   mov dword[tree1.box_left],edi
  271.   mov dword[tree2.box_left],edi
  272.  
  273.   mov eax,dword[tree2.box_left] ;¤¢¨£ ¥¬ áªà®««¨­£
  274.   add eax,dword[tree2.box_width]
  275.   mov ebx,dword[tree2.p_scroll]
  276.   mov word[ebx+2],ax
  277.  
  278.   mov dword[edit2.left],edi
  279.   add dword[edit2.left],370-otst_panel_left
  280.  
  281.   stdcall dword[tl_draw],dword tree1
  282.   stdcall dword[tl_draw],dword tree2
  283.   mov dword[wScrMetki.all_redraw],1
  284.   stdcall [scrollbar_ver_draw], dword wScrMetki
  285.  
  286.   mov esi,[sc.work_button]
  287.   mcall 8,145*65536+20,5*65536+25,6 ;ª­®¯ª 
  288.  
  289.   mcall ,100*65536+20,5*65536+25,5
  290.  
  291.   mov ebx,170*65536+40 ;ª­®¯ª  ¢ë§®¢  ¤¨ «®£  OpenDial
  292.   ;mov ecx,5*65536+25
  293.   mov edx,13
  294.   int 0x40
  295.  
  296.   mov bx,di
  297.   shl ebx,16
  298.   mov bx,100
  299.   mov ecx,265*65536+25
  300.   mov edx,9
  301.   int 0x40
  302.  
  303.   ;ebx ...
  304.   mov ecx,235*65536+25
  305.   mov edx,8
  306.   int 0x40
  307.  
  308.   mov bx,di
  309.   add bx,410-otst_panel_left
  310.   shl ebx,16
  311.   mov bx,55
  312.   ;mov ebx,410*65536+55
  313.   mov ecx,5*65536+25
  314.   mov edx,7
  315.   int 0x40
  316.  
  317.   mov bx,di
  318.   add bx,440-otst_panel_left
  319.   shl ebx,16
  320.   mov bx,30
  321.   ;mov ebx,440*65536+30
  322.   mov ecx,265*65536+25
  323.   mov edx,12
  324.   int 0x40
  325.  
  326.   mov bx,di
  327.   add bx,405-otst_panel_left
  328.   shl ebx,16
  329.   mov bx,30
  330.   ;mov ebx,405*65536+30
  331.   ;mov ecx,265*65536+25
  332.   mov edx,11
  333.   int 0x40
  334.  
  335.   mov bx,di
  336.   add bx,370-otst_panel_left
  337.   shl ebx,16
  338.   mov bx,30
  339.   ;mov ebx,370*65536+30
  340.   ;mov ecx,265*65536+25
  341.   mov edx,10
  342.   int 0x40
  343.  
  344.   mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
  345.   mov ebx,152*65536+13
  346.   mov ecx,[sc.work_button_text]
  347.   or  ecx,0x80000000
  348.   mov edx,txt_zoom_p
  349.   mcall
  350.  
  351.   mov ebx,107*65536+13
  352.   mov edx,txt_zoom_m
  353.   int 0x40
  354.  
  355.   mov bx,di
  356.   add bx,270-otst_panel_left
  357.   shl ebx,16
  358.   mov bx,243
  359.   ;mov ebx,270*65536+243
  360.   mov edx,txt151
  361.   int 0x40
  362.  
  363.   mov bx,di
  364.   add bx,270-otst_panel_left
  365.   shl ebx,16
  366.   mov bx,273
  367.   ;mov ebx,270*65536+273
  368.   mov edx,txt152
  369.   int 0x40
  370.  
  371.   mov bx,di
  372.   add bx,415-otst_panel_left
  373.   shl ebx,16
  374.   mov bx,13
  375.   ;mov ebx,415*65536+13
  376.   mov edx,txt_but_refresh
  377.   int 0x40
  378.  
  379.   mov bx,di
  380.   add bx,380-otst_panel_left
  381.   shl ebx,16
  382.   mov bx,275
  383.   ;mov ebx,380*65536+275
  384.   mov edx,txt_met_up
  385.   int 0x40
  386.  
  387.   mov bx,di
  388.   add bx,415-otst_panel_left
  389.   shl ebx,16
  390.   mov bx,275
  391.   ;mov ebx,415*65536+275
  392.   mov edx,txt_met_dn
  393.   int 0x40
  394.  
  395.  
  396.   mov bx,di
  397.   add bx,450-otst_panel_left
  398.   shl ebx,16
  399.   mov bx,275
  400.   ;mov ebx,450*65536+275
  401.   mov edx,txt_met_sh
  402.   int 0x40
  403.  
  404.   mov ebx,175*65536+13
  405.   mov edx,txt_cache
  406.   int 0x40
  407.  
  408.   mov ecx,[sc.work_text]
  409.   or  ecx,0x80000000
  410.  
  411.   mov bx,di
  412.   ;add bx,450-otst_panel_left
  413.   shl ebx,16
  414.   mov bx,35
  415.   ;mov ebx,265*65536+35
  416.   mov edx,txt141
  417.   int 0x40
  418.  
  419.   mov bx,135
  420.   ;mov ebx,265*65536+135
  421.   mov edx,txt142
  422.   int 0x40
  423.  
  424.   call draw_tiles
  425.  
  426.   stdcall [check_box_draw], dword ch1
  427.   stdcall [check_box_draw], dword ch2
  428.   stdcall [edit_box_draw], edit1
  429.   stdcall [edit_box_draw], edit2
  430.  
  431.   mcall 12,2
  432. popad
  433.   ret
  434.  
  435.   head_f_i:
  436.   head_f_l  db '‘¨á⥬­ ï ®è¨¡ª ',0
  437.   err_message_found_lib0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  box_lib.obj',0
  438.   err_message_import0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ box_lib.obj',0
  439.   err_message_found_lib1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  libimg.obj',0
  440.   err_message_import1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libimg.obj',0
  441.   err_message_found_lib2 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  str.obj',0
  442.   err_message_import2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ str.obj',0
  443.   err_message_found_lib3 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  libini.obj',0
  444.   err_message_import3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libini.obj',0
  445.   err_message_found_lib4 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  proc_lib.obj',0
  446.   err_message_import4 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ proc_lib.obj',0
  447.  
  448. system_dir0 db '/sys/lib/'
  449. lib0_name db 'box_lib.obj',0
  450.  
  451. system_dir1 db '/sys/lib/'
  452. lib1_name db 'libimg.obj',0
  453.  
  454. system_dir2 db '/sys/lib/'
  455. lib2_name db 'str.obj',0
  456.  
  457. system_dir3 db '/sys/lib/'
  458. lib3_name db 'libini.obj',0
  459.  
  460. system_dir4 db '/sys/lib/'
  461. lib4_name db 'proc_lib.obj',0
  462.  
  463. ;library structures
  464. l_libs_start:
  465.         lib0 l_libs lib0_name, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l, boxlib_import,err_message_import0, head_f_i
  466.         lib1 l_libs lib1_name, sys_path, file_name, system_dir1, err_message_found_lib1, head_f_l, libimg_import, err_message_import1, head_f_i
  467.         lib2 l_libs lib2_name, sys_path, file_name, system_dir2, err_message_found_lib2, head_f_l, strlib_import, err_message_import2, head_f_i
  468.         lib3 l_libs lib3_name, sys_path, file_name, system_dir3, err_message_found_lib3, head_f_l, libini_import, err_message_import3, head_f_i
  469.         lib4 l_libs lib4_name, sys_path, file_name, system_dir4, err_message_found_lib4, head_f_l, proclib_import, err_message_import4, head_f_i
  470. load_lib_end:
  471.  
  472. align 4
  473. button:
  474.         mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
  475.         cmp ah,5
  476.         jne @f
  477.                 call but_ZoomM
  478.                 jmp still
  479.         @@:
  480.         cmp ah,6
  481.         jne @f
  482.                 call but_ZoomP
  483.                 jmp still
  484.         @@:
  485.         cmp ah,7
  486.         jne @f
  487.                 call but_Refresh
  488.                 jmp still
  489.         @@:
  490.  
  491.         cmp ah,9
  492.         jz  but_MetSave
  493.         cmp ah,8
  494.         jz  but_MetAdd
  495.  
  496.         cmp ah,10
  497.         jne @f
  498.                 call but_met_up
  499.                 jmp still
  500.         @@:
  501.         cmp ah,11
  502.         jne @f
  503.                 call but_met_dn
  504.                 jmp still
  505.         @@:
  506.         cmp ah,12
  507.         jne @f
  508.                 call fun_goto_met
  509.                 jmp still
  510.         @@:
  511.         cmp ah,13 ;¤¨ «®£ OpenDialog ¤«ï ¯®¨áª  ¯ ¯ª¨
  512.         jne @f
  513.                 call fun_opn_dlg
  514.                 jmp still
  515.         @@:
  516.         cmp ah,1
  517.         jne still
  518.  
  519. .exit:
  520.         push dword[bmp_icon]
  521.         call mem.Free
  522.         stdcall array_tile_function, tile_00,max_tiles_count,tile_destroy
  523.  
  524.         stdcall dword[tl_data_clear], tree1
  525.         mov dword[tree2.data_img_sys],0 ;ç¨á⨬ 㪠§ â¥«ì ­  á¨á⥬­ë¥ ¨ª®­ª¨,
  526.                 ;â. ª. ®­¨ ¡ë«¨ 㤠«¥­ë ¢¥àå­¥© ä㭪樥© tl_data_clear
  527.                 ;¯®¢â®à­ë© ¢ë§®¢ tl_data_clear ¡¥§ ç¨á⪨ 㪠§ â¥«ï ¢ë§¢¥â ®è¨¡ªã
  528.         mov dword[tree2.data_img],0 ;ç¨á⨬ 㪠§ â¥«ì ­  ¨ª®­ª¨ 㧫®¢
  529.         stdcall dword[tl_data_clear], tree2
  530.  
  531. ;  stdcall dword[img_destroy], dword[data_icon]
  532.         mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
  533.  
  534.  
  535. ;input:
  536. ;data_rgb - pointer to rgb data
  537. ;size - count img pixels (size img data / 3(rgb) )
  538. align 4
  539. proc img_rgb_wdiv2 uses eax ebx ecx edx, data_rgb:dword, size:dword
  540.   mov eax,dword[data_rgb]
  541.   mov ecx,dword[size] ;ecx = size
  542.   imul ecx,3
  543.   @@: ;§ â¥¬­¥­¨¥ æ¢¥â  ¯¨ªá¥«¥©
  544.     shr byte[eax],1
  545.     and byte[eax],0x7f
  546.     inc eax
  547.     loop @b
  548.  
  549.   mov eax,dword[data_rgb]
  550.   mov ecx,dword[size] ;ecx = size
  551.   shr ecx,1
  552.   @@: ;á«®¦¥­¨¥ 梥⮢ ¯¨ªá¥«¥©
  553.     mov ebx,dword[eax+3] ;ª®¯¨à㥬 梥â á®á¥¤­¥£® ¯¨ªá¥«ï
  554.     add word[eax],bx
  555.     shr ebx,16
  556.     add byte[eax+2],bl
  557.  
  558.     add eax,6 ;=2*3
  559.     loop @b
  560.  
  561.   mov eax,dword[data_rgb]
  562.   add eax,3
  563.   mov ebx,eax
  564.   add ebx,3
  565.   mov ecx,dword[size] ;ecx = size
  566.   shr ecx,1
  567.   dec ecx ;«¨è­¨© ¯¨ªá¥«ì
  568.   @@: ;¯®¤¦ â¨¥ ¯¨ªá¥«¥©
  569.     mov edx,dword[ebx]
  570.     mov word[eax],dx
  571.     shr edx,16
  572.     mov byte[eax+2],dl
  573.  
  574.     add eax,3
  575.     add ebx,6
  576.     loop @b
  577.   ret
  578. endp
  579.  
  580. ;input:
  581. ;data_rgb - pointer to rgb data
  582. ;size - count img pixels (size img data / 3(rgb) )
  583. ;size_w - width img in pixels
  584. align 4
  585. proc img_rgb_hdiv2, data_rgb:dword, size:dword, size_w:dword
  586.   pushad
  587.  
  588.   mov eax,dword[data_rgb] ;eax =
  589.   mov ecx,dword[size]     ;ecx = size
  590.   imul ecx,3
  591.   @@: ;§ â¥¬­¥­¨¥ æ¢¥â  ¯¨ªá¥«¥©
  592.     shr byte[eax],1
  593.     and byte[eax],0x7f
  594.     inc eax
  595.     loop @b
  596.  
  597.   mov eax,dword[data_rgb] ;eax =
  598.   mov edi,dword[size_w]
  599.   lea esi,[edi+edi*2] ;esi = width*3(rgb)
  600.   mov ebx,esi
  601.   add ebx,eax
  602.   mov ecx,dword[size]  ;ecx = size
  603.   shr ecx,1
  604.   xor edi,edi
  605.   @@: ;á«®¦¥­¨¥ 梥⮢ ¯¨ªá¥«¥©
  606.     mov edx,dword[ebx] ;ª®¯¨à㥬 梥⠭¨¦­¥£® ¯¨ªá¥«ï
  607.     add word[eax],dx
  608.     shr edx,16
  609.     add byte[eax+2],dl
  610.  
  611.     add eax,3
  612.     add ebx,3
  613.     inc edi
  614.     cmp edi,dword[size_w]
  615.     jl .old_line
  616.       add eax,esi
  617.       add ebx,esi
  618.       xor edi,edi
  619.     .old_line:
  620.     loop @b
  621.  
  622.  
  623.   mov eax,dword[data_rgb] ;eax =
  624.   add eax,esi ;esi = width*3(rgb)
  625.   mov ebx,esi
  626.   add ebx,eax
  627.   mov ecx,dword[size] ;ecx = size
  628.   shr ecx,1
  629.   sub ecx,dword[size_w] ;«¨è­ïï áâப  ¯¨ªá¥«¥©
  630.   xor edi,edi
  631.   @@: ;¯®¤¦ â¨¥ ¯¨ªá¥«¥©
  632.     mov edx,dword[ebx] ;ª®¯¨à㥬 梥⠭¨¦­¥£® ¯¨ªá¥«ï
  633.     mov word[eax],dx
  634.     shr edx,16
  635.     mov byte[eax+2],dl
  636.  
  637.     add eax,3
  638.     add ebx,3
  639.     inc edi
  640.     cmp edi,dword[size_w]
  641.     jl .old_line_2
  642.       add ebx,esi
  643.       xor edi,edi
  644.     .old_line_2:
  645.     loop @b
  646.  
  647.   popad
  648.   ret
  649. endp
  650.  
  651. ;input:
  652. ;data_rgb - pointer to rgb data
  653. ;size - count img pixels (size img data / 3(rgb) )
  654. align 4
  655. proc img_rgb_wmul2 uses eax ebx ecx edx, data_rgb:dword, size:dword
  656.         ;eax - source
  657.         ;ebx - destination
  658.         mov ecx,dword[size] ;ecx = size
  659.         mov eax,ecx
  660.         dec eax
  661.         lea eax,[eax+eax*2] ;eax = (size-1)*3
  662.         mov ebx,eax ;ebx = size*3
  663.         add eax,dword[data_rgb] ;eax = pointer + size*3
  664.         add ebx,eax ;ebx = pointer + 2*size*3
  665.         @@:
  666.                 mov edx,dword[eax] ;edx = pixel color
  667.                 mov word[ebx],dx
  668.                 mov word[ebx+3],dx
  669.                 shr edx,16
  670.                 mov byte[ebx+2],dl
  671.                 mov byte[ebx+3+2],dl
  672.                 sub eax,3
  673.                 sub ebx,6
  674.                 loop @b
  675.         ret
  676. endp
  677.  
  678. ;äã­ªæ¨ï ¤«ï à áâ¢ ­¨ï ¨§®¡à ¦¥­¨ï ¯® ¢ëá®â¥ ¢ 2 à § 
  679. ;¢ 㪠§ â¥«¥ data_rgb ¯ ¬ï⨠¤®«¦­® ¡ëâì ¢ 2 à §  ¡®«ìè¥ ç¥¬ size*3
  680. ;¨­ ç¥ ¯à¨ à áâ¢ ­¨¨ ¡ã¤¥â ®è¨¡ª , ¢ë室  ­  çã¦ãî ¯ ¬ïâì
  681. ;input:
  682. ;data_rgb - pointer to rgb data
  683. ;size - count img pixels (size img data / 3(rgb) )
  684. ;size_w - width img in pixels
  685. align 4
  686. proc img_rgb_hmul2, data_rgb:dword, size:dword, size_w:dword
  687.   pushad
  688.  
  689.   mov esi,dword[size_w]
  690.   lea esi,[esi+esi*2] ;esi = width * 3(rgb)
  691.   mov eax,dword[size]
  692.   lea eax,[eax+eax*2]
  693.   mov edi,eax
  694.   shl edi,1
  695.   add eax,dword[data_rgb] ;eax = pointer to end pixel (old image) + 1
  696.   add edi,dword[data_rgb] ;edi = pointer to end pixel (new image) + 1
  697.   mov ebx,edi
  698.   sub ebx,esi
  699.  
  700.   .beg_line:
  701.   mov ecx,dword[size_w]
  702.   @@:
  703.     sub eax,3
  704.     sub ebx,3
  705.     sub edi,3
  706.  
  707.     mov edx,dword[eax] ;edx = pixel color
  708.     mov word[ebx],dx
  709.     mov word[edi],dx
  710.     shr edx,16
  711.     mov byte[ebx+2],dl
  712.     mov byte[edi+2],dl
  713.  
  714.     loop @b
  715.  
  716.   sub ebx,esi
  717.   sub edi,esi
  718.  
  719.   cmp eax,dword[data_rgb]
  720.   jg .beg_line
  721.  
  722.   popad
  723.   ret
  724. endp
  725.  
  726. ;input:
  727. ;data_rgb - pointer to rgb data
  728. ;size - count img pixels (size img data / 3(rgb) )
  729. ;size_w - width img in pixels
  730. align 4
  731. proc img_rgb_hoffs uses eax ebx ecx edx esi, data_rgb:dword, size:dword, size_w:dword, hoffs:dword
  732.         mov esi,dword[size_w]
  733.         lea esi,[esi+esi*2] ;esi = width * 3(rgb)
  734.         imul esi,dword[hoffs]
  735.  
  736.         mov eax,dword[size]
  737.         lea eax,[eax+eax*2]
  738.         add eax,dword[data_rgb] ;eax = pointer to end pixel + 1
  739.         sub eax,3
  740.         mov ebx,eax
  741.         add ebx,esi
  742.  
  743.         mov ecx,dword[size]
  744.         dec ecx
  745.         @@:
  746.                 mov edx,dword[eax] ;edx = pixel color
  747.                 mov word[ebx],dx
  748.                 shr edx,16
  749.                 mov byte[ebx+2],dl
  750.  
  751.                 sub eax,3
  752.                 sub ebx,3
  753.                 loop @b
  754.         ret
  755. endp
  756.  
  757.  
  758. ;input:
  759. ;data_rgb - pointer to rgb data
  760. ;size_w_old - width img in pixels
  761. ;size_w_new - new width img in pixels
  762. ;size_h - height img in pixels
  763. align 4
  764. proc img_rgb_wcrop, data_rgb:dword, size_w_old:dword, size_w_new:dword, size_h:dword
  765.   pushad
  766.     mov eax, dword[size_w_old]
  767.     lea eax, dword[eax+eax*2] ;eax = width(old) * 3(rgb)
  768.     mov ebx, dword[size_w_new]
  769.     lea ebx, dword[ebx+ebx*2] ;ebx = width(new) * 3(rgb)
  770.     mov edx, dword[size_h]
  771.     ;dec edx
  772.     mov edi, dword[data_rgb] ;edi - ¯®«ã砥⠤ ­­ë¥
  773.     mov esi, edi
  774.     add edi, ebx
  775.     add esi, eax
  776.     cld
  777.   @@:
  778.     dec edx ;㬥­ìè ¥¬ áç¥â稪 ®áâ ¢è¨åáï áâப ­  1
  779.     cmp edx,0
  780.     jle @f
  781.  
  782.     mov ecx, ebx
  783.     rep movsb ;¯¥à¥­®á (ª®¯¨à®¢ ­¨¥) áâப¨ ¯¨ªá¥«¥©
  784. ;stdcall mem_copy,esi,edi,ebx
  785.  
  786.     add esi,eax ;¯¥à¥å®¤ ­  ­®¢ãî áâà®çªã ¨§®¡à ¦¥­¨ï
  787.     sub esi,ebx
  788. ;add esi,eax
  789. ;add edi,ebx
  790.     jmp @b
  791.   @@:
  792.  
  793.   popad
  794.   ret
  795. endp
  796.  
  797. align 4
  798. proc mem_copy uses ecx esi edi, source:dword, destination:dword, len:dword
  799.         cld
  800.         mov esi, dword[source]
  801.         mov edi, dword[destination]
  802.         mov ecx, dword[len]
  803.         rep movsb
  804.         ret
  805. endp
  806.  
  807. align 4
  808. proc mem_clear uses eax ecx edi, mem:dword, len:dword
  809.         cld
  810.         xor al,al
  811.         mov edi, dword[mem]
  812.         mov ecx, dword[len]
  813.         repne stosb
  814.         ret
  815. endp
  816.  
  817. align 4
  818. fun_opn_dlg: ;äã­ªæ¨ï ¤«ï ¢ë§®¢  OpenFile ¤¨ «®£ 
  819.         pushad
  820.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  821.         mov [OpenDialog_data.type],2
  822.         mov dword[plugin_path],0 ;çâ®-¡ë ¯à¨ ®âªàë⨨ ¤¨ «®£®¢®£® ®ª­  ¯ãâì ¢á¥£¤  ¡à «áï ¨§ OpenDialog_data.dir_default_path
  823.  
  824.         stdcall [OpenDialog_Start],OpenDialog_data
  825.         cmp [OpenDialog_data.status],2
  826.         je @f
  827.                 stdcall [str_len],dword[edit1.text],dword[edit1.max]
  828.                 mov [edit1.size],eax
  829.                 mov [edit1.pos],eax
  830.                 stdcall [edit_box_draw], edit1
  831.         @@:
  832.         popad
  833.         ret
  834.  
  835.   txt_met_up db 24,0
  836.   txt_met_dn db 25,0
  837.   txt_met_sh db '*',0
  838.   txt_zoom_m db '-',0
  839.   txt_zoom_p db '+',0
  840.   txt151 db '„®¡ ¢¨âì ¬¥âªã',0
  841.   txt152 db '‘®åà ­¨âì ¬¥âª¨',0
  842.   txt_but_refresh db 'Ž¡­®¢¨âì',0
  843.   txt_cache db 'Cache:',0
  844.   txt141 db '‚¨¤ ª àâë',0
  845.   txt142 db '‚ë¡®à ¬¥âª¨',0
  846.  
  847. ; check_boxes
  848. ch1 check_box2 (5 shl 16)+12,  (5 shl 16)+12, 6, 0xffffd0, 0x800000, 0, ch_text1, ch_flag_en
  849. ch2 check_box2 (5 shl 16)+12, (20 shl 16)+12, 6, 0xffffd0, 0x800000, 0, ch_text2, ch_flag_en
  850. checkboxes_end:
  851.  
  852. ch_text1 db '¡à âì ᢥàåã',0
  853. ch_text2 db '¡à âì á­¨§ã',0
  854.  
  855. edit1 edit_box 190, 215,  10, 0xd0ffff, 0xff, 0x80ff, 0, 0xa000, 4090, openfile_path, mouse_dd, 0
  856. edit2 edit_box 100, 370, 240, 0xd0ffff, 0xff, 0x80ff, 0, 0xa000,  30, ed_buffer.2, mouse_dd, 0
  857. editboxes_end:
  858.  
  859. tree1 tree_list 10,10, tl_list_box_mode+tl_key_no_edit, 16,16,\
  860.     0x8080ff,0x0000ff,0xffffff, 265,45,90,85, 0,0,0,\
  861.     el_focus, 0,fun_new_map_type
  862. tree2 tree_list 32,300, tl_draw_par_line, 16,16,\
  863.     0x8080ff,0x0000ff,0xffffff, 265,145,190,85, 0,12,0,\
  864.     el_focus, wScrMetki,fun_goto_met
  865.  
  866. align 4
  867. wScrMetki scrollbar 16,0, 100,0, 15, 100, 30,0, 0xeeeeee, 0xbbddff, 0, 1
  868.  
  869. ed_buffer: ;òåêñò äëÿ edit
  870.   .2: rb 32
  871.  
  872. el_focus dd tree1
  873.  
  874. tree_sys_icon dd 0
  875. tree_nod_icon dd 0
  876.  
  877. bmp_icon   dd 0 ;¯ ¬ïâì ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨ï
  878. data_icon  dd 0 ;¯ ¬ïâì ¤«ï ¯à¥®¡à §®¢ ­¨ï ª à⨭ª¨ äã­ªæ¨ï¬¨ libimg
  879.  
  880. run_file_70 FileInfoBlock
  881.  
  882.  
  883. txt_tile_path db 'tile path',0
  884.   rb 300
  885. txt_tile_type dd txt_tile_type_0 ;㪠§ â¥«ì ­  ¢ë¡à ­­ë© ⨯ ä ©«®¢
  886. txt_tile_type_0 db 0
  887.   rb 10
  888.  
  889. ;---------------------------------------------------------------------
  890. align 4
  891. OpenDialog_data:
  892. .type                   dd 2
  893. .procinfo               dd procinfo     ;+4
  894. .com_area_name          dd communication_area_name      ;+8
  895. .com_area               dd 0    ;+12
  896. .opendir_path           dd plugin_path  ;+16
  897. .dir_default_path       dd default_dir ;+20
  898. .start_path             dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
  899. .draw_window            dd draw_window  ;+28
  900. .status                 dd 0    ;+32
  901. .openfile_path          dd openfile_path        ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
  902. .filename_area          dd filename_area        ;+40
  903. .filter_area            dd Filter
  904. .x:
  905. .x_size                 dw 420 ;+48 ; Window X size
  906. .x_start                dw 10 ;+50 ; Window X position
  907. .y:
  908. .y_size                 dw 320 ;+52 ; Window y size
  909. .y_start                dw 10 ;+54 ; Window Y position
  910.  
  911. default_dir db '/rd/1',0 ;¤¨à¥ªâ®à¨ï ¯® 㬮«ç ­¨î
  912.  
  913. communication_area_name:
  914.         db 'FFFFFFFF_open_dialog',0
  915. open_dialog_name:
  916.         db 'opendial',0
  917. communication_area_default_path:
  918.         db '/rd/1/File managers/',0
  919.  
  920. Filter:
  921. dd Filter.end - Filter.1
  922. .1:
  923. db 'TXT',0
  924. .end:
  925. db 0
  926.  
  927. align 4
  928. map: ;ª®®à¤¨­ âë ª àâë
  929.   .coord_x dd 0 ;ª®®à¤¨­ â  x
  930.   .coord_y dd 0 ;ª®®à¤¨­ â  y
  931.   .zoom    db 1 ;¬ áèâ ¡
  932.  
  933. align 4
  934. tile_00 rb size_tile_struc * max_tiles_count
  935.  
  936. ;input:
  937. ; eax - ç¨á«®
  938. ; edi - ¡ãä¥à ¤«ï áâப¨
  939. ; len - ¤«¨­­  ¡ãä¥à 
  940. ;output:
  941. align 4
  942. proc convert_int_to_str, len:dword
  943. pushad
  944.         mov esi,[len]
  945.         add esi,edi
  946.         dec esi
  947.         call .str
  948. popad
  949.         ret
  950. endp
  951.  
  952. align 4
  953. .str:
  954.         mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
  955.         ;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
  956.         cmp eax,ecx ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
  957.         jb @f
  958.                 xor edx,edx ;®ç¨áâ¨âì edx
  959.                 div ecx   ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
  960.                 push edx  ;¯®«®¦¨âì ¢ á⥪
  961.                 ;dec edi  ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
  962.                 call .str ;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
  963.                 pop eax
  964.         @@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
  965.         cmp edi,esi
  966.         jge @f
  967.                 or al,0x30 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥  ç¥¬ ¤¢¥ ¢ëè¥
  968.                 stosb      ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
  969.                 mov byte[edi],0 ;¢ ª®­¥æ áâப¨ áâ ¢¨¬ 0, çâ®-¡ë ­¥ ¢ë« §¨« ¬ãá®à
  970.         @@:
  971.         ret        ;¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
  972.  
  973.  
  974. hed db 'Planet viewer 09.11.15',0 ;¯®¤¯¨áì ®ª­ 
  975.  
  976. sc system_colors  ;á¨á⥬­ë¥ 梥â 
  977. mouse_dd dd 0 ;­ã¦­® ¤«ï Shift-  ¢ editbox
  978. align 16
  979. i_end:
  980.         procinfo process_information
  981.         rb 1024
  982. stacktop:
  983.         sys_path rb 4096
  984.         file_name:
  985.                 rb 4096
  986.         plugin_path:
  987.                 rb 4096
  988.         openfile_path:
  989.                 rb 4096
  990.         filename_area:
  991.                 rb 256
  992. mem:
  993.  
  994.