Subversion Repositories Kolibri OS

Rev

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