Subversion Repositories Kolibri OS

Rev

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