Subversion Repositories Kolibri OS

Rev

Rev 2632 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;
  2. ; äã­ªæ¨ ¤«ï ᮧ¤ ­¨ï ᨣ­ «®¢
  3. ;
  4.  
  5. ;color_s0 - ᨣ­ « 0
  6. ;color_s1 - ᨣ­ « 1
  7. ;color_s2 - â®çª  ¡¥§ ¯¥à¥á¥ç¥­¨ï
  8. ;color_s3 - ¢à¥¬¥­­®¥ §­ ç¥­¨¥ ¤«ï á®åà ­¥­¨ï
  9.  
  10. size_sign equ 10
  11. sign_x equ 0
  12. sign_y equ 4
  13. sign_a equ 8
  14. sign_z equ 9
  15.  
  16. sign_data dd 0 ;㪠§ â¥«ì ­  ¬ áᨢ á® áâàãªâãà ¬¨ ᨣ­ «®¢
  17. sign_count dd 0 ;⥪ãé. ª®«. ᨣ­ «®¢
  18. sign_max dd 0 ;¬ ªá. ª®«. ᨣ­ «®¢
  19.  
  20. align 4
  21. proc sign_init uses eax ecx, m_count:dword
  22.         mov ecx,[m_count]
  23.         mov [sign_max],ecx
  24.         imul ecx,size_sign
  25.         stdcall mem.Alloc, ecx
  26.         mov [sign_data],eax
  27.         call sign_clear
  28.         ret
  29. endp
  30.  
  31. ;®ç¨á⪠ ¢á¥å ᨣ­ «®¢
  32. align 4
  33. proc sign_clear uses eax ecx edi
  34.         xor eax,eax
  35.         mov dword[time],eax
  36.         mov dword[sign_count],eax
  37.         mov ecx,[sign_max]
  38.         imul ecx,size_sign
  39.         mov edi,[sign_data]
  40.         cld
  41.         rep stosb
  42.         ret
  43. endp
  44.  
  45. ;®ç¨á⪠ ®¤­®£® ᨣ­ « 
  46. align 4
  47. proc sign_clear_one uses ecx edi esi, p_sign:dword
  48.         mov ecx,size_sign
  49.         mov esi,[sign_count]
  50.         dec esi
  51.         imul esi,ecx
  52.         add esi,[sign_data]
  53.         mov edi,[p_sign]
  54.         cld
  55.         rep movsb
  56.         dec dword[sign_count]
  57.         ret
  58. endp
  59.  
  60. ;®á¢®¡®¦¤¥­¨¥ ¯ ¬ï⨠§ ­ï⮩ ¬ áᨢ ¬¨ ¤«ï ᨣ­ «®¢
  61. align 4
  62. proc sign_delete
  63.         stdcall mem.Free, dword[sign_data]
  64.         ret
  65. endp
  66.  
  67. ;äã­ªæ¨ï ¤«ï ¯¥à¥¬¥é¥­¨ï ᨣ­ «®¢
  68. align 4
  69. proc sign_move
  70.         pushad
  71.         mov ecx,[sign_count]
  72.         cmp ecx,1
  73.         jl .end_f
  74.         mov esi,ecx
  75.         dec esi
  76.         imul esi,size_sign
  77.         add esi,[sign_data]
  78.         ;cld
  79.         .cycle_beg:
  80.                 mov eax,[esi+sign_x]
  81.                 mov ebx,[esi+sign_y]
  82.                 movzx edi,byte[esi+sign_a]
  83.                 movzx edx,byte[esi+sign_z]
  84.                 cmp edx,0
  85.                 je @f
  86.                         or edi,0x100
  87.                 @@:
  88.  
  89.                 ;¯ëâ ¥¬áï ᮧ¤ âì à §¢¥â¢«¥­¨¥ ᨣ­ « 
  90.                 stdcall move_rotate_n90, 0,-1,edi
  91.                 inc edi
  92.                 stdcall sign_creat,eax,ebx,edi
  93.  
  94.                 stdcall move_rotate_n90, -2,0,edi
  95.                 add edi,2
  96.                 stdcall sign_creat,eax,ebx,edi
  97.  
  98.                 mov eax,[esi+sign_x]
  99.                 mov ebx,[esi+sign_y]
  100.                 inc edi
  101.  
  102.                 mov eax,[esi+sign_x]
  103.                 mov ebx,[esi+sign_y]
  104.                 shl edx,2
  105.                 add edx,shem_colors
  106.                 stdcall draw_signal_rect, eax,ebx, dword[edx] ;à¨á㥬 ᨣ­ « ­  ¯®«¥
  107.  
  108.                 .move_1:
  109.                 stdcall move_rotate_x_n90, 1,edi
  110.  
  111.                 mov edi,eax
  112.                 stdcall pole_cell_find, pole, edi,ebx
  113.                 cmp eax,0
  114.                 jne @f
  115.                         stdcall sign_clear_one,esi ;㤠«¥­¨¥ ᨣ­ « , ¥á«¨ ®­ § è¥« ¢ â㯨ª
  116.                         jmp .cycle_next
  117.                 @@:
  118.                 imul eax,sizeof.Cell
  119.                 add eax,dword[cell]
  120.                 movzx edx,byte[esi+sign_z]
  121.  
  122.                 cmp byte[eax+offs_cell_liv],2
  123.                 jne @f
  124.                         ;¥á«¨ á⮨⠯¥à¥á¥ç¥­¨¥ ¯à®¢®¤®¢
  125.                         mov eax,edi
  126.                         movzx edi,byte[esi+sign_a]
  127.                         jmp .move_1
  128.                 @@:
  129.                 cmp byte[eax+offs_cell_liv],dl
  130.                 jne @f
  131.                         stdcall sign_clear_one,esi ;㤠«¥­¨¥ ᨣ­ « , ¥á«¨ ®­ ¯®¯ « ­  ®¡« áâì § ªà è¥­ãî ¤ ­­ë¬ 梥⮬
  132.                         jmp .cycle_next
  133.                 @@:
  134.                 mov byte[eax+offs_cell_liv],dl ;áâ ¢¨¬ ­  ¯®«¥ §­ ª ᨣ­ « 
  135.  
  136.                 mov [esi+sign_x],edi
  137.                 mov [esi+sign_y],ebx
  138.  
  139.                 .cycle_next:
  140.  
  141.                 sub esi,size_sign
  142.                 ;loop .cycle_beg
  143.                 dec ecx
  144.                 jnz .cycle_beg
  145.         ;stdcall [buf2d_draw], buf_0
  146.         .end_f:
  147.         popad
  148.         ret
  149. endp
  150.  
  151. align 4
  152. proc sign_creat coord_x:dword, coord_y:dword, opt:dword
  153. pushad
  154.         mov edi,[sign_count]
  155.         cmp edi,[sign_max]
  156.         jge .end_f
  157.         mov esi,[coord_x]
  158.         mov ebx,[coord_y]
  159.         .found:
  160.         stdcall pole_cell_find, pole, esi,ebx
  161.         cmp eax,0
  162.         je .end_f
  163.                 mov ecx,[opt]
  164.                 get_cell_offset edx,eax
  165.                 cmp byte[edx+offs_cell_liv],2
  166.                 jne @f
  167.                         mov eax,esi
  168.                         stdcall move_rotate_x_n90,1,ecx
  169.                         mov esi,eax
  170.                         jmp .found
  171.                 @@:
  172.                 cmp ch,byte[edx+offs_cell_liv] ;¯à®¢¥à塞 ­  ¯®«¥ §­ ª ᨣ­ « 
  173.                 je .end_f
  174.                 ;¤®¤¥« âì ãáâ ­®¢ªã ¬¥âª¨ ¢ ¯à®¢®¤, çâ®-¡ë ¨§¡¥¦ âì ¤ã¡«¨à®¢ ­¨ï ᨣ­ «®¢ ­  è¨à®ª¨å ¯à®¢®¤ å
  175.                 imul edi,size_sign
  176.                 add edi,[sign_data]
  177.                 mov [edi+sign_x],esi
  178.                 mov [edi+sign_y],ebx
  179.                 mov [edi+sign_a],cl
  180.                 mov [edi+sign_z],ch
  181.                 inc dword[sign_count]
  182.                 mov [edx+offs_cell_liv],ch ;áâ ¢¨¬ ­  ¯®«¥ §­ ª ᨣ­ « 
  183.                 ;stdcall draw_signal_rect, [coord_x],[coord_y], 0x800080
  184.         .end_f:
  185. popad
  186.         ret
  187. endp
  188.  
  189. ;description:
  190. ; ¯®¤äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï ᨣ­ «®¢ ­  á奬¥
  191. align 4
  192. proc draw_signal_rect uses eax ebx edi, x0:dword,y0:dword, color:dword
  193.         movzx edi,byte[zoom]
  194.         mov ebx,[y0]
  195.         mov eax,[x0]
  196.  
  197.         add ebx,[Cor_y]
  198.         imul ebx,edi
  199.         add eax,[Cor_x]
  200.         imul eax,edi
  201.  
  202.         stdcall [buf2d_filled_rect_by_size], buf_0, eax,ebx,edi,edi, dword[color]
  203.         ret
  204. endp
  205.  
  206. align 4
  207. proc sign_from_elems
  208. locals
  209.         s_inp dd ?
  210.         n_leg dd ?
  211. endl
  212.         pushad
  213.         mov edi,pole
  214.         ;*** ᮧ¤ ­¨¥ ᨣ­ «®¢ ¨§ «®£¨ç¥áª¨å í«¥¬¥­â®¢ ***
  215.         stdcall dword[tl_node_poi_get_info], tree1,0
  216.         mov esi,eax
  217.         @@:
  218.                 cmp esi,0
  219.                 je @f
  220.                 cmp word[esi],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  221.                 jne .end_add_p3
  222.                         stdcall [tl_node_poi_get_data], tree1,esi
  223.                         mov ecx,eax
  224.  
  225.                         ;*** ¯à®¢¥àª  ᨣ­ «®¢ ­  ¢å®¤­ëå ­®£ å
  226.                         mov dword[s_inp],0
  227.                         mov dword[n_leg],0 ;word[n_leg] - ­®¬¥à ¢å®¤­®© ­®£¨
  228.                         mov edx,1
  229.                         .add_p1:
  230.                                 stdcall el_get_leg_coords, ecx,dword[n_leg]
  231.                                 test eax,eax
  232.                                 jnz .get1
  233.                                 test ebx,ebx
  234.                                 jnz .get1
  235.                                         jmp .end_add_p1 ;¥á«¨ ª®®à¤¨­ âë ­¥ ¢§ï«¨áì (eax=0 && ebx=0), ¢ë室 ¨§ 横« 
  236.                                 .get1:
  237.                                 stdcall pole_cell_find, pole, eax,ebx
  238.                                 cmp eax,0
  239.                                 je .get2
  240.                                         imul eax,sizeof.Cell
  241.                                         add eax,pole_data
  242.                                         cmp byte[eax+offs_cell_liv],1
  243.                                         jne .get2
  244.                                         or dword[s_inp],edx
  245.                                 .get2:
  246.                                 inc dword[n_leg]
  247.                                 shl edx,1
  248.                                 jmp .add_p1
  249.                         .end_add_p1:
  250.  
  251.                         ;*** ®¯à¥¤¥«ï¥¬ ¢ë室­ãî ª®¬¡¨­ æ¨î ¡¨â®¢ ­  ®á­®¢¥ § ¤ ­­®© â ¡«¨æë à ¡®âë í«¥¬¥­â 
  252.                         movzx eax,byte[ecx+sp_offs_el_type]
  253.                         imul eax,size_el_opt
  254.                         add eax,el_opt_beg+el_offs_table
  255.                         mov ebx,[eax]
  256.                         add ebx,dword[s_inp]
  257.                         mov ebx,[ebx]
  258.                         mov dword[s_inp],ebx
  259.  
  260.                         ;*** ãáâ ­®¢ª  ᨣ­ «®¢ ­  ¢ë室­ëå ­®£ å
  261.                         mov dword[n_leg],(1 shl 16) ;word[n_leg] - ­®¬¥à ¢ë室­®© ­®£¨
  262.                         .add_p2:
  263.                                 stdcall el_get_leg_coords, ecx,dword[n_leg]
  264.                                 test eax,eax
  265.                                 jnz .get3
  266.                                 test ebx,ebx
  267.                                 jnz .get3
  268.                                         jmp .end_add_p2 ;¥á«¨ ª®®à¤¨­ âë ­¥ ¢§ï«¨áì (eax=0 && ebx=0), ¢ë室 ¨§ 横« 
  269.                                 .get3:
  270.                                 movzx edx,byte[ecx+8] ;dl - ­ ¯à ¢«¥­¨¥ ᨣ­ « 
  271.                                 bt dword[s_inp],0
  272.                                 jnc .set1
  273.                                         or edx,0x100 ;dh - §­ ç¥­¨¥ ᨣ­ «  0 ¨«¨ 1
  274.                                 .set1:
  275.                                 stdcall sign_creat,eax,ebx,edx
  276.                                 inc dword[n_leg]
  277.                                 shr dword[s_inp],1
  278.                                 jmp .add_p2
  279.                         .end_add_p2:
  280.  
  281.                 .end_add_p3:
  282.                 stdcall dword[tl_node_poi_get_next_info], tree1,esi
  283.                 mov esi,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  284.                 jmp @b
  285.         @@:
  286.         popad
  287.         ret
  288. endp
  289.  
  290. ;ᮧ¤ ­¨¥ ᨣ­ «®¢ ­  ®á­®¢¥ ¯®¤¯¨á¥©
  291. align 4
  292. proc sign_from_captions
  293.         pushad
  294.         ;*** ᮧ¤ ­¨¥ ᨣ­ «®¢ ¨§ ¯®¤¯¨á¥© ***
  295.         stdcall dword[tl_node_poi_get_info], tree1,0
  296.         mov esi,eax
  297.         @@:
  298.                 cmp esi,0
  299.                 je @f
  300.                 cmp word[esi],el_icon_captions ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  301.                 jne .end_add_p3
  302.                         stdcall [tl_node_poi_get_data], tree1,esi
  303.                         mov ecx,eax
  304.  
  305.                         cmp byte[ecx+8],'n'
  306.                         je .end_add_p3 ;¥á«¨ ­ ¤¯¨áì ¨­ä®à¬ æ¨®­­ ï, â® ­¥ ᮧ¤ ¥¬ ᨣ­ « 
  307.  
  308.                         ;xor edx,edx
  309.                         movzx edx,byte[ecx+9] ;¯¥à¢®­ ç «ì­®¥ ­ ¯à¢«¥­¨¥ ¢ë室­®£® ᨣ­ « 
  310.                         ;*** ®¯à¥¤¥«ï¥¬ ¢ë室®© ¡¨â,
  311.                         ;ª®â®àë© ¡ë« ãáâ ­®¢«¥­ ¢ but_set_0 ¨ but_set_1
  312.                         cmp byte[ecx+8],'o'
  313.                         jne .end_add_p1
  314.                                 or edx,0x100
  315.                         .end_add_p1:
  316.                         stdcall sign_creat,dword[ecx],dword[ecx+4],edx
  317.  
  318.                 .end_add_p3:
  319.                 stdcall dword[tl_node_poi_get_next_info], tree1,esi
  320.                 mov esi,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  321.                 jmp @b
  322.         @@:
  323.         popad
  324.         ret
  325. endp
  326.  
  327. ; ¨§¬¥­ï¥¬ ¯¥à¢®­ ç «ì­®¥ ­ ¯à¢«¥­¨¥ ¢ë室­®£® ᨣ­ « 
  328. ; ¢ëáâ ¢«ïîâáï 2 ­ ¯à ¢«¥­¨ï: á«¥¢  ­  ¯à ¢®, á¯à ¢  ­  «¥¢®
  329. ; ®áâ «ì­ë¥ 2 ¢®§¬®¦­ëå ­ ¯à ¢«¥­¨ï ­¥ ãç¨â뢠îâáï,
  330. ; â. ª. ¯®¢®à®âë ᨣ­ «®¢ ¢®§¬®¦­ë ¨ ¡¥§ ­¨å
  331. align 4
  332. proc sign_set_captions_angles
  333.         pushad
  334.         mov edi,pole
  335.         stdcall dword[tl_node_poi_get_info],tree1,0
  336.         mov esi,eax
  337.         .cycle0:
  338.                 cmp esi,0
  339.                 je .cycle0_end
  340.                 cmp word[esi],el_icon_captions ;¯®«ã祭¨¥ ç¥à¥§ esi ⨯ ¨ª®­ª¨
  341.                 jne .end_p0
  342.                         stdcall [tl_node_poi_get_data], tree1,esi
  343.                         mov ecx,eax
  344.  
  345.                         mov ebx,[ecx] ;ebx = coord x
  346.                         xor edx,edx
  347.                         dec ebx
  348.                         stdcall pole_cell_find, edi, ebx,dword[ecx+4]
  349.                         cmp eax,0
  350.                         je @f
  351.                                 mov edx,2
  352.                                 ;jmp .set_angle
  353.                         @@:
  354.  
  355.                         ;.set_angle:
  356.                         mov byte[ecx+9],dl ;¯¥à¢®­ ç «ì­®¥ ­ ¯à¢«¥­¨¥ ¢ë室­®£® ᨣ­ « 
  357.                 .end_p0:
  358.                 stdcall dword[tl_node_poi_get_next_info], tree1,esi
  359.                 mov esi,eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
  360.                 jmp .cycle0
  361.         .cycle0_end:
  362.         popad
  363.         ret
  364. endp
  365.