Subversion Repositories Kolibri OS

Rev

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