Subversion Repositories Kolibri OS

Rev

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