Subversion Repositories Kolibri OS

Rev

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

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