Subversion Repositories Kolibri OS

Rev

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

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