Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. ;FigureInit, (¢à¥¬. áâà.), (Object.FigData)
  3.  
  4. ;add_object_in_list, ___, ___, (¢à¥¬. áâà.), (Object.FigData)
  5. ;       mov [Object.FigData], (tl_node_add(¢à¥¬. áâà.),tl_node_get_data)
  6.  
  7. ;draw_fig2d_litl, ___, pobj, (Object.FigData), ___, ___, ___
  8.  
  9. struct Object
  10.         OType dd ?
  11.         FigCount dd ?
  12.         FigData dd ? ;array pointers to Figures
  13.         MinX dq ?
  14.         MinY dq ?
  15.         SizeX dq ?
  16.         SizeY dq ?
  17.         WScale dq ? ;prewiew window scale
  18.         MScale dq ? ;mouse scale (show partition figure)
  19.         MCentrX dd ? ;mouse centr X
  20.         MCentrY dd ? ;mouse centr Y
  21.         Caption rb 32
  22. ends
  23.  
  24. struct Figure
  25.         OType dd ?
  26.         PoiCount dd ?
  27.         PoiData dd ?
  28.         MinX dq ?
  29.         MinY dq ?
  30.         SizeX dq ?
  31.         SizeY dq ?
  32.         WScale dq ? ;prewiew window scale (show all figure)
  33.         MScale dq ? ;mouse scale (show partition figure)
  34.         MCentrX dd ? ;mouse centr X
  35.         MCentrY dd ? ;mouse centr Y
  36.         Caption rb 32
  37. ends
  38.  
  39. struct Point
  40.         Prop dd ? ;prorerties
  41.         CoordX dq ? ;coord X
  42.         CoordY dq ? ;coord Y
  43. ends
  44.  
  45. txt_err_1 db 'Žè¨¡ª  ¯à¨ áç¨â뢠­¨¨ ®¡ê¥ªâ ',0
  46. txt_err_2 db 'Žè¨¡ª  ¯à¨ áç¨â뢠­¨¨ 䨣ãàë',0
  47. txt_err_3 db '¥ ­ ©¤¥­  â®çª  ¢ 䨣ãà¥',0
  48. txt_err_no_figure_select db '¥ ¢ë¡à ­  ª®¬ ­¤  ¤«ï ¯¥à¥¬¥é¥­¨ï',0
  49. txt_err_figure_is_0 db 'Š®¬ ­¤  ­¥ ¬®¦¥â ¡ëâì ᤢ¨­ãâ  ¢¢¥àå,',13,10,'®­  ¢ ­ ç «¥ ᯨ᪠.',0
  50. txt_err_figure_is_last db 'Š®¬ ­¤  ­¥ ¬®¦¥â ¡ëâì ᤢ¨­ãâ  ¢­¨§,',13,10,'®­  ¢ ª®­æ¥ ᯨ᪠.',0
  51. txt_err_no_point_del db '¥ ¬®¦­  㤠«¨âì ¢á¥ â®çª¨ ¨§ 䨣ãàë.',0
  52. txt_err_poi_is_0 db '¥ ¬®¦­  ¯¥à¥¬¥áâ¨âì â®çªã ¢¢¥àå,',13,10,'®­  ¢ ­ ç «¥ ᯨ᪠.',0
  53. txt_err_poi_is_last db '¥ ¬®¦­  ¯¥à¥¬¥áâ¨âì â®çªã ¢­¨§,',13,10,'®­  ¢ ª®­æ¥ ᯨ᪠.',0
  54. txt_err_no_1_point_sel db '‚ë¡¥à¨â¥ ­¥ ¡®«ìè¥ ®¤­®© â®çª¨.',0
  55.  
  56. txt_min_x db 'min x: ',0
  57. txt_min_y db 'min y: ',0
  58.  
  59. if lang eq ru
  60. ;
  61. ; rus
  62. ;
  63. txt_err_no_point_sel db '¥ ¢ë¡à ­ë â®çª¨.',0
  64. txt_err_no_point_sel_1 db '‚ë¡¥à¨â¥ ®¤­ã â®çªã.',0
  65. txt_but_cancel db 'Žâ¬¥­ ',0
  66. txt_but_apply db 'à¨¬¥­¨âì',0
  67. txt_but_create db '‘®§¤ âì',0
  68. txt_size_x db 'à §¬¥à x: ',0
  69. txt_size_y db 'à §¬¥à y: ',0
  70. txt_poi_sel: db '‚ë¡à ­® â®ç¥ª: '
  71. .end db 0
  72. txt_err_save_txt_file_0:
  73.         db '¥ ¬®£ã á®åà ­¨âì *.nc ä ©«.',0
  74. txt_err_save_txt_file_1:
  75.         db '¥ 㤠«®áì á®åà ­¨âì ¢¥áì *.nc ä ©«.',0
  76. txt_err_save_img_file:
  77.         db '¥ ¬®£ã á®åà ­¨âì *.png ä ©«.',0
  78. txt_obj: db 'Ž¡ê¥ªâ: ',39
  79. .end db 0
  80. else
  81. ;
  82. ; eng
  83. ;
  84. txt_err_no_point_sel db 'No select points.',0
  85. txt_err_no_point_sel_1 db 'Select one point.',0
  86. txt_but_cancel db 'Cancel',0
  87. txt_but_apply db 'Apply',0
  88. txt_but_create db 'Create',0
  89. txt_size_x db 'size x: ',0
  90. txt_size_y db 'size y: ',0
  91. txt_poi_sel: db 'Select points: '
  92. .end db 0
  93. txt_err_save_txt_file_0:
  94. txt_err_save_txt_file_1:
  95.         db 'Can',39,'t save *.nc file.',0
  96. txt_err_save_img_file:
  97.         db 'Can',39,'t save *.png file.',0
  98. txt_obj: db 'Object: ',39
  99. .end db 0
  100. end if
  101.  
  102. align 4
  103. txt_s_39 db 39,' ',0
  104. txt_s_poi db 'X',0
  105. txt_s_poi_Y db ' Y',0
  106. txt_s_poi_Z db ' Z',0
  107. txt_coma db ','
  108. txt_space db ' ',0 ;­¥ ®âà뢠âì ®â § ¯ï⮩
  109. txt_nl db 13,10,0
  110. txt_n db 13,0
  111. txt_ls db ' (',0
  112. txt_rs db ')',0
  113. txt_len db ' len=',0
  114. txt_39 db 39,0
  115.  
  116. ;᢮©á⢠ ¤«ï à¨á®¢ ­¨ï â®ç¥ª
  117. PROP_BIT_SELECT    equ 30 ;â®çª  ¯®¤ ¢ë¤¥«¥­¨¥¬
  118.  
  119. align 4
  120. zoom_plus dq 1.25992105
  121. opt_koef dq 0.02 ;ª®¥ä. ¤«ï ®¯â¨¬¨§ æ¨¨ (祬 ¡«¨¦¥ ª 0, ⥬ ¯àﬥ¥ «¨­¨ï)
  122. mouse_prop_x dd 0 ;ªãàá®à ¬ëè¨ ®â­®á¨â¥«ì­® 業âà  ®ª­  buf_0 (¤«ï ¨§¬¥­. ¬ áèâ ¡ )
  123. mouse_prop_y dd 0
  124. mouse_down_x dd 0 ;ªãàá®à ¬ëè¨ ®â­®á¨â¥«ì­® «¥¢®£® ¢¥àå­¥£® 㣫  ®ª­  buf_0 (¤«ï ᤢ¨£  䨣ãàë)
  125. mouse_down_y dd 0
  126. opt_draw  dd 1
  127. graf_margin_left   dd 3 ;margin in pixels
  128. graf_margin_right  dd 3+6 ;margin in pixels
  129. graf_margin_top    dd 3+9 ;margin in pixels
  130. graf_margin_bot    dd 3+9 ;margin in pixels
  131. png_data dd ?
  132. png_size dd ?
  133.  
  134. ;global variables:
  135. ObjData Object
  136. FigData Figure ;¢à¥¬¥­­ ï áâàãªâãà  ¤«ï § ¯®«­¥­¨ï tree1
  137. PoiData Point
  138.  
  139. size_one_list equ sizeof.Figure ;max (sizeof.Figure, sizeof.Object)
  140.  
  141. if sizeof.Object > sizeof.Figure
  142.    ... need fix size_one_list
  143. end if
  144.  
  145. if (Object.FigCount <> Figure.PoiCount) | (Object.FigData <> Figure.PoiData) | (Object.MScale <> Figure.MScale) | (Object.MCentrX <> Figure.MCentrX) | (Object.MCentrY <> Figure.MCentrY)
  146.    ... need fix offsets
  147. end if
  148.        
  149. align 4
  150. Scale1mm dq 11.81102362204724 ;pixels in 1 mm -> 300 dpi
  151.         ;5.905511811023622 ;pixels in 1 mm -> 150 dpi
  152.  
  153. txt_buf rb 80 ;???
  154. txt_sp db ' ',0
  155.  
  156. ;input:
  157. ; esi - text pointer
  158. align 4
  159. proc txt_next_line uses eax ecx edi, mlen:dword
  160.         mov al,13
  161.         mov ecx,[mlen]
  162.         mov edi,esi
  163.         repne scasb
  164.         cmp byte[edi],10
  165.         jne @f
  166.                 inc edi
  167.         @@:
  168.         mov esi,edi
  169.         ret
  170. endp
  171.  
  172. ;input:
  173. ; edi - destination buffer
  174. ; esi - source text string: '...\nl
  175. ; mlen - maximum len destination buffer
  176. align 4
  177. proc txt_load_line uses eax ebx ecx esi, mlen:dword
  178.         mov byte[edi],0
  179.         mov al,13
  180.         cmp byte[esi],al
  181.         je .end_f
  182.                 mov ecx,[mlen]
  183.                 mov ebx,edi
  184.                 mov edi,esi
  185.                 repne scasb ;found end of string
  186.                 mov ecx,edi
  187.                 sub ecx,esi
  188.                 dec ecx ;ecx = string len
  189.                 mov edi,ebx
  190.                 rep movsb ;copy caption string
  191.                 cmp byte[esi],13
  192.                 je @f
  193.                 .cycle0:
  194.                         inc esi
  195.                         cmp byte[esi],13
  196.                         jne .cycle0
  197.                 @@:
  198.                 mov byte[edi],0
  199.                 inc esi
  200.         .end_f:
  201.         ret
  202. endp
  203.  
  204. ;input:
  205. ; itxt - input description text
  206. ; msize - max size
  207. align 4
  208. proc FileInit uses eax ebx ecx edi esi, itxt:dword, msize:dword
  209.         stdcall [tl_node_poi_get_info], tree1,0
  210.         or eax,eax
  211.         jz @f
  212.                 mov ebx,eax
  213.                 stdcall [tl_node_poi_get_data], tree1,ebx
  214.                 stdcall clear_object_in_list, eax
  215.         @@:
  216.         stdcall [tl_info_clear], tree1 ;®ç¨á⪠ ᯨ᪠ ®¡ê¥ªâ®¢
  217.         mov dword[offs_last_timer],0
  218.  
  219.         mov esi,[itxt]
  220.         mov ebx,esi
  221.         add ebx,[msize]
  222.         stdcall ObjectInit,ObjData,ebx
  223.         stdcall [tl_cur_beg], tree1
  224.         ret
  225. endp
  226.  
  227. ;input:
  228. ; esi - input description text
  229. ; pobj - pointer to object struct
  230. ; etxt - pointer to end of input text
  231. align 4
  232. proc ObjectInit uses eax ebx ecx edi, pobj:dword, etxt:dword
  233.                 mov ebx,[pobj]
  234.                 mov [ebx+Object.OType],'Obj'
  235.                 mov edi,ebx
  236.                 add edi,Object.Caption
  237.                 mov dword[edi],'CNC'
  238.  
  239.                 stdcall get_max_lines
  240.                 test eax,eax
  241.                 jz .err_init
  242.                 mov [ebx+Object.FigCount],eax
  243.                 mov ecx,eax
  244.  
  245.                 shl eax,2
  246.                 stdcall mem.Alloc,eax
  247.                 mov [ebx+Object.FigData],eax
  248.                 push ecx
  249.                         mov edi,eax
  250.                         xor eax,eax
  251.                         rep stosd ;clear memory
  252.                 pop ecx
  253.  
  254.                 stdcall add_object_in_list,0,0,ebx,0
  255.                 ;eax -> pointer to object node
  256.                 mov edi,[ebx+Object.FigData]
  257. align 4
  258.                 .cycle0:
  259.                         stdcall FigureInit,FigData,edi
  260.                         cmp esi,[etxt]
  261.                         jge .cycle0end
  262.                         add edi,4
  263.                 loop .cycle0
  264.                 .cycle0end:
  265.                 inc dword[ebx+Object.FigCount] ;???
  266.                 or ecx,ecx
  267.                 jz @f
  268.                         ;㬥­ìè ¥¬ ®¡ê¥¬ ¯ ¬ï⨠¢ë¤¥«¥­­ë© ¤«ï ª®¬ ­¤
  269.                         sub [ebx+Object.FigCount],ecx
  270.                         mov eax,[ebx+Object.FigCount]
  271.                         shl eax,2
  272.                         stdcall mem.ReAlloc,[ebx+Object.FigData],eax
  273.                         mov [ebx+Object.FigData],eax
  274.                 @@:
  275.  
  276.                 stdcall ObjCalculateScale,ebx
  277.  
  278.                 jmp .end_f
  279.         .err_init:
  280.                 notify_window_run txt_err_1
  281.         .end_f:
  282.         ret
  283. endp
  284.  
  285. align 4
  286. proc ObjCalculateScale uses eax ebx ecx edi, pobj:dword
  287.         mov ebx,[pobj]
  288.  
  289.         ;*** Calculate scale for object ***
  290.         finit
  291.  
  292.         ;found min coord X
  293.         mov ecx,[ebx+Object.FigCount]
  294.         jecxz .cycle2end
  295.         mov edi,[ebx+Object.FigData]
  296.         @@:
  297.                 mov eax,[edi]
  298.                 dec ecx
  299.                 jecxz .cycle2end
  300.                 add edi,4
  301.                 or eax,eax
  302.                 jz @b
  303.                 cmp [eax+Figure.PoiCount],0
  304.                 je @b
  305.         push edi esi ;copy first min X
  306.                 lea esi,[eax+Figure.MinX]
  307.                 lea edi,[ebx+Object.MinX]
  308.                 movsd
  309.                 movsd
  310.         pop esi edi
  311. align 4
  312.         .cycle2:
  313.                 mov eax,[edi]
  314.                 or eax,eax
  315.                 jz @f
  316.                 cmp [eax+Figure.PoiCount],0
  317.                 je @f
  318.                 fld qword[eax+Figure.MinX]
  319.                 fcomp qword[ebx+Object.MinX]
  320.                 fstsw ax
  321.                 sahf
  322.                 jae @f
  323.                         push edi esi
  324.                         mov eax,[edi]
  325.                         lea esi,[eax+Figure.MinX]
  326.                         lea edi,[ebx+Object.MinX]
  327.                         movsd
  328.                         movsd
  329.                         pop esi edi
  330.                 @@:
  331.                 add edi,4
  332.         loop .cycle2
  333.         .cycle2end:
  334.  
  335.         ;found min coord Y
  336.         mov ecx,[ebx+Object.FigCount]
  337.         jecxz .cycle3end
  338.         mov edi,[ebx+Object.FigData]
  339.         @@:
  340.                 mov eax,[edi]
  341.                 dec ecx
  342.                 jecxz .cycle3end
  343.                 add edi,4
  344.                 or eax,eax
  345.                 jz @b
  346.                 cmp [eax+Figure.PoiCount],0
  347.                 je @b
  348.         push edi esi ;copy first min Y
  349.                 lea esi,[eax+Figure.MinY]
  350.                 lea edi,[ebx+Object.MinY]
  351.                 movsd
  352.                 movsd
  353.         pop esi edi
  354. align 4
  355.         .cycle3:
  356.                 mov eax,[edi]
  357.                 or eax,eax
  358.                 jz @f
  359.                 cmp [eax+Figure.PoiCount],0
  360.                 je @f
  361.                 fld qword[eax+Figure.MinY]
  362.                 fcomp qword[ebx+Object.MinY]
  363.                 fstsw ax
  364.                 sahf
  365.                 jae @f
  366.                         push edi esi
  367.                         mov eax,[edi]
  368.                         lea esi,[eax+Figure.MinY]
  369.                         lea edi,[ebx+Object.MinY]
  370.                         movsd
  371.                         movsd
  372.                         pop esi edi
  373.                 @@:
  374.                 add edi,4
  375.         loop .cycle3
  376.         .cycle3end:
  377.  
  378.         ;found max coord X
  379.         mov ecx,[ebx+Object.FigCount]
  380.         jecxz .cycle4end
  381.         mov edi,[ebx+Object.FigData]
  382.         ;copy first min X
  383.         mov eax,[edi]
  384.         fld qword[eax+Figure.MinX]
  385.         fadd qword[eax+Figure.SizeX]
  386.         fstp qword[ebx+Object.SizeX]
  387.         dec ecx
  388.         jecxz .cycle4end
  389. align 4
  390.         .cycle4:
  391.                 add edi,4
  392.                 mov eax,[edi]
  393.                 or eax,eax
  394.                 jz @f
  395.                 cmp [eax+Figure.PoiCount],0
  396.                 je @f
  397.                 fld qword[eax+Figure.MinX]
  398.                 fadd qword[eax+Figure.SizeX]
  399.                 fcomp qword[ebx+Object.SizeX]
  400.                 fstsw ax
  401.                 sahf
  402.                 jbe @f
  403.                         mov eax,[edi]
  404.                         fld qword[eax+Figure.MinX]
  405.                         fadd qword[eax+Figure.SizeX]
  406.                         fstp qword[ebx+Object.SizeX]
  407.                 @@:
  408.         loop .cycle4
  409.         .cycle4end:
  410.  
  411.         ;found max coord Y
  412.         mov ecx,[ebx+Object.FigCount]
  413.         jecxz .cycle5end
  414.         mov edi,[ebx+Object.FigData]
  415.         ;copy first min Y
  416.         mov eax,[edi]
  417.         fld qword[eax+Figure.MinY]
  418.         fadd qword[eax+Figure.SizeY]
  419.         fstp qword[ebx+Object.SizeY]
  420.         dec ecx
  421.         jecxz .cycle5end
  422. align 4
  423.         .cycle5:
  424.                 add edi,4
  425.                 mov eax,[edi]
  426.                 or eax,eax
  427.                 jz @f
  428.                 cmp [eax+Figure.PoiCount],0
  429.                 je @f
  430.                 fld qword[eax+Figure.MinY]
  431.                 fadd qword[eax+Figure.SizeY]
  432.                 fcomp qword[ebx+Object.SizeY]
  433.                 fstsw ax
  434.                 sahf
  435.                 jbe @f
  436.                         mov eax,[edi]
  437.                         fld qword[eax+Figure.MinY]
  438.                         fadd qword[eax+Figure.SizeY]
  439.                         fstp qword[ebx+Object.SizeY]
  440.                 @@:
  441.         loop .cycle5
  442.         .cycle5end:
  443.  
  444.         ;found size X
  445.         fld qword[ebx+Object.SizeX]
  446.         fsub qword[ebx+Object.MinX]
  447.         fstp qword[ebx+Object.SizeX]
  448.         ;found size Y
  449.         fld qword[ebx+Object.SizeY]
  450.         fsub qword[ebx+Object.MinY]
  451.         fstp qword[ebx+Object.SizeY]
  452.  
  453.         ;*** Calculate scale ***
  454.                 fld1
  455.                 fstp qword[ebx+Object.WScale] ;set default scale
  456.  
  457.                 fld qword[ebx+Object.SizeX]
  458.                 ftst
  459.                 fstsw ax
  460.                 sahf
  461.                 jne .els_0 ;if (SizeX == 0.0)
  462.                         ffree st0
  463.                         fincstp
  464.                         jmp .els_1
  465.                 .els_0: ;else if (SizeX != 0.0)
  466.                         fild dword[buf_0.w]
  467.                         fisub dword[graf_margin_left]
  468.                         fisub dword[graf_margin_right]
  469.                         fxch st1
  470.                         fdivp
  471.                         fstp qword[ebx+Object.WScale]
  472.                 .els_1:
  473.  
  474.                 fld qword[ebx+Object.SizeY]
  475.                 ftst
  476.                 fstsw ax
  477.                 sahf
  478.                 jne .els_2 ;if (SizeY == 0.0)
  479.                         ffree st0
  480.                         fincstp
  481.                         jmp .els_3
  482.                 .els_2: ;else if (SizeY != 0.0)
  483.                         fild dword[buf_0.h]
  484.                         fisub dword[graf_margin_top]
  485.                         fisub dword[graf_margin_bot]
  486.                         fxch st1
  487.                         fdivp
  488.                         fcom qword[ebx+Object.WScale]
  489.                         fstsw ax
  490.                         sahf
  491.                         jbe @f
  492.                                 ffree st0
  493.                                 fincstp
  494.                                 jmp .els_3
  495.                         @@:
  496.                         fstp qword[ebx+Object.WScale]
  497.                 .els_3:
  498.  
  499.                 fld1
  500.                 fstp qword[ebx+Figure.MScale]
  501.                 mov dword[ebx+Figure.MCentrX],0
  502.                 mov dword[ebx+Figure.MCentrY],0
  503.         ret
  504. endp
  505.  
  506. ;input:
  507. ; esi - input description text
  508. ; pmem - pointer to memory for struct
  509. ; pfig - pointer to figure struct
  510. ;output:
  511. ; esi - output description text
  512. align 4
  513. proc FigureInit uses eax ebx ecx edx edi, pmem:dword, pfig:dword
  514.         mov ebx,[pmem]
  515.         mov [ebx+Figure.OType],'Fig'
  516.         mov edi,ebx
  517.         add edi,Figure.Caption
  518.         stdcall txt_load_line,32
  519.                
  520.         xor eax,eax
  521.         mov [ebx+Figure.PoiCount],eax
  522.         mov [ebx+Figure.PoiData],eax
  523.         cmp byte[esi],'X'
  524.         jne .end0
  525.                 stdcall get_max_points
  526.                 mov [ebx+Figure.PoiCount],eax
  527.                 or eax,eax
  528.                 jz .end0
  529.                 mov ecx,eax
  530.                 imul eax,sizeof.Point
  531.                 stdcall mem.Alloc,eax
  532.                 mov [ebx+Figure.PoiData],eax
  533.                 or eax,eax
  534.                 jz .err_init
  535.                 mov edi,eax
  536. align 4
  537.                 .cycle0:
  538.                         stdcall PointInit,edi
  539.                         or eax,eax
  540.                         jz .cycle0end
  541.                         add edi,sizeof.Point
  542.                         loop .cycle0
  543.                 .cycle0end:
  544.                 or ecx,ecx
  545.                 jz .end1
  546.                         ;㬥­ìè ¥¬ ®¡ê¥¬ ¯ ¬ï⨠¢ë¤¥«¥­­ë© ¤«ï â®ç¥ª
  547.                         sub [ebx+Figure.PoiCount],ecx
  548.                         mov eax,[ebx+Figure.PoiCount]
  549.                         imul eax,sizeof.Point
  550.                         stdcall mem.ReAlloc,[ebx+Figure.PoiData],eax
  551.                         mov [ebx+Figure.PoiData],eax
  552.                 jmp .end1
  553.         .err_init:
  554.                 notify_window_run txt_err_2
  555.         .end0:
  556.                 ;command
  557.                 stdcall txt_next_line, 80
  558.                 cmp byte[esi],13
  559.                 jne @f
  560.                         ;if null line
  561.                         inc esi
  562.                         cmp byte[esi],10
  563.                         jne .end2
  564.                                 inc esi
  565.                         .end2:
  566.                         mov dword[edi],(10 shl 8)+13 ;new line
  567.                 @@:
  568.                 stdcall add_object_in_list,1,1,ebx,[pfig]
  569.                 jmp .end_f
  570.         .end1:
  571.                 ;coords
  572.                 stdcall add_object_in_list,2,1,ebx,[pfig]
  573.                 or eax,eax
  574.                 jz .end_f
  575.                 stdcall FigCalculateSizes,eax,1
  576.         .end_f:
  577.         ret
  578. endp
  579.  
  580. ;input:
  581. ; esi - pointer to file
  582. ;output:
  583. ; eax - max lines in file
  584. align 4
  585. proc get_max_lines uses esi
  586.         xor eax,eax
  587.         .cycle0:
  588.                 cmp byte[esi],13
  589.                 jne @f
  590.                         inc eax
  591.                 @@:
  592.                 inc esi
  593.                 cmp byte[esi],0
  594.                 jne .cycle0
  595.         ret
  596. endp
  597.  
  598. ;input:
  599. ; esi - pointer to file
  600. ;output:
  601. ; eax - max point coords in file
  602. align 4
  603. proc get_max_points uses esi
  604.         xor eax,eax
  605.         .cycle0:
  606.                 cmp word[esi],' Y'
  607.                 jne @f
  608.                         inc eax
  609.                 @@:
  610.                 inc esi
  611.                 cmp byte[esi+1],0
  612.                 jne .cycle0
  613.         ret
  614. endp
  615.  
  616. ;input:
  617. ; opt_calc - ¥á«¨ 0 - ¯¥à¥áç¨â âì ¬ áèâ ¡ 䨣ãàë,
  618. ;                 1 - ¯¥à¥áç¨â âì à §¬¥àë ¨ ¬ áèâ ¡ 䨣ãàë
  619. align 4
  620. proc FigCalculateSizes uses eax ebx ecx edi esi, pfig:dword, opt_calc:dword
  621.         mov ebx,[pfig]
  622.         or ebx,ebx
  623.         jz .end_f
  624.  
  625.         finit
  626.         bt dword[opt_calc],0
  627.         jnc .calc_scale
  628.  
  629.         ;*** Calculate sizes ***
  630.         mov esi,[ebx+Figure.PoiData]
  631.         or esi,esi
  632.         jz .end_f
  633.  
  634.         lea esi,[esi+Point.CoordX]
  635.         lea edi,[ebx+Figure.MinX]
  636.         movsd
  637.         movsd ;Figure.MinX = Point[0].CoordX
  638.         sub esi,8
  639.         lea edi,[ebx+Figure.SizeX]
  640.         movsd
  641.         movsd ;Figure.SizeX = Point[0].CoordX
  642.         mov esi,[ebx+Figure.PoiData]
  643.         lea esi,[esi+Point.CoordY]
  644.         lea edi,[ebx+Figure.MinY]
  645.         movsd
  646.         movsd ;Figure.MinY = Point[0].CoordY
  647.         sub esi,8
  648.         lea edi,[ebx+Figure.SizeY]
  649.         movsd
  650.         movsd ;Figure.SizeY = Point[0].CoordY
  651.  
  652.         ;found min coord X
  653.         mov ecx,[ebx+Figure.PoiCount]
  654.         jecxz .cycle2end
  655.         mov edi,[ebx+Figure.PoiData]
  656. align 4
  657.         .cycle2:
  658.                 fld qword[edi+Point.CoordX]
  659.                 fcomp qword[ebx+Figure.MinX]
  660.                 fstsw ax
  661.                 sahf
  662.                 ja @f
  663.                         push edi esi
  664.                         lea esi,[edi+Point.CoordX]
  665.                         lea edi,[ebx+Figure.MinX]
  666.                         movsd
  667.                         movsd
  668.                         pop esi edi
  669.                 @@:
  670.                 add edi,sizeof.Point
  671.         loop .cycle2
  672.         .cycle2end:
  673.  
  674.         ;found min coord Y
  675.         mov ecx,[ebx+Figure.PoiCount]
  676.         jecxz .cycle3end
  677.         mov edi,[ebx+Figure.PoiData]
  678. align 4
  679.         .cycle3:
  680.                 fld qword[edi+Point.CoordY]
  681.                 fcomp qword[ebx+Figure.MinY]
  682.                 fstsw ax
  683.                 sahf
  684.                 ja @f
  685.                         push edi esi
  686.                         lea esi,[edi+Point.CoordY]
  687.                         lea edi,[ebx+Figure.MinY]
  688.                         movsd
  689.                         movsd
  690.                         pop esi edi
  691.                 @@:
  692.                 add edi,sizeof.Point
  693.         loop .cycle3
  694.         .cycle3end:
  695.  
  696.         ;found max coord X
  697.         mov ecx,[ebx+Figure.PoiCount]
  698.         jecxz .cycle4end
  699.         mov edi,[ebx+Figure.PoiData]
  700. align 4
  701.         .cycle4:
  702.                 fld qword[edi+Point.CoordX]
  703.                 fcomp qword[ebx+Figure.SizeX]
  704.                 fstsw ax
  705.                 sahf
  706.                 jbe @f
  707.                         push edi esi
  708.                         lea esi,[edi+Point.CoordX]
  709.                         lea edi,[ebx+Figure.SizeX]
  710.                         movsd
  711.                         movsd
  712.                         pop esi edi
  713.                 @@:
  714.                 add edi,sizeof.Point
  715.         loop .cycle4
  716.         .cycle4end:
  717.  
  718.         ;found max coord Y
  719.         mov ecx,[ebx+Figure.PoiCount]
  720.         jecxz .cycle5end
  721.         mov edi,[ebx+Figure.PoiData]
  722. align 4
  723.         .cycle5:
  724.                 fld qword[edi+Point.CoordY]
  725.                 fcomp qword[ebx+Figure.SizeY]
  726.                 fstsw ax
  727.                 sahf
  728.                 jbe @f
  729.                         push edi esi
  730.                         lea esi,[edi+Point.CoordY]
  731.                         lea edi,[ebx+Figure.SizeY]
  732.                         movsd
  733.                         movsd
  734.                         pop esi edi
  735.                 @@:
  736.                 add edi,sizeof.Point
  737.         loop .cycle5
  738.         .cycle5end:
  739.  
  740.         ;found size X
  741.         fld qword[ebx+Figure.SizeX]
  742.         fsub qword[ebx+Figure.MinX]
  743.         fstp qword[ebx+Figure.SizeX]
  744.         ;found size Y
  745.         fld qword[ebx+Figure.SizeY]
  746.         fsub qword[ebx+Figure.MinY]
  747.         fstp qword[ebx+Figure.SizeY]
  748.                
  749.         ;*** Calculate scale ***
  750. align 4
  751.         .calc_scale:
  752.         mov dword[ebx+Figure.MCentrX],0
  753.         mov dword[ebx+Figure.MCentrY],0
  754.         fld1
  755.         fst qword[ebx+Figure.MScale] ;???
  756.         fstp qword[ebx+Figure.WScale] ;set default scale
  757.  
  758.         fld qword[ebx+Figure.SizeX]
  759.         ftst
  760.         fstsw ax
  761.         sahf
  762.         jne .els_0 ;if (SizeX == 0.0)
  763.                 ffree st0
  764.                 fincstp
  765.                 jmp .els_1
  766.         .els_0: ;else if (SizeX != 0.0)
  767.                 fild dword[buf_0.w]
  768.                 fisub dword[graf_margin_left]
  769.                 fisub dword[graf_margin_right]
  770.                 fxch st1
  771.                 fdivp
  772.                 fstp qword[ebx+Figure.WScale]
  773.         .els_1:
  774.  
  775.         fld qword[ebx+Figure.SizeY]
  776.         ftst
  777.         fstsw ax
  778.         sahf
  779.         jne .els_2 ;if (SizeY == 0.0)
  780.                 ffree st0
  781.                 fincstp
  782.                 jmp .els_3
  783.         .els_2: ;else if (SizeY != 0.0)
  784.                 fild dword[buf_0.h]
  785.                 fisub dword[graf_margin_top]
  786.                 fisub dword[graf_margin_bot]
  787.                 fxch st1
  788.                 fdivp
  789.                 fcom qword[ebx+Figure.WScale]
  790.                 fstsw ax
  791.                 sahf
  792.                 jbe @f
  793.                         ffree st0
  794.                         fincstp
  795.                         jmp .els_3
  796.                 @@:
  797.                 fstp qword[ebx+Figure.WScale]
  798.         .els_3:
  799.  
  800.         .end_f:
  801.         ret
  802. endp
  803.  
  804. ;input:
  805. ; esi - input description text
  806. ; ppoi - pointer to point struct
  807. ;output:
  808. ; eax - 0 (if error init) or 1
  809. ; esi - output description text
  810. align 4
  811. proc PointInit uses ebx ecx edi, ppoi:dword
  812.         mov     ecx,64 ;§ é¨â  ®â § æ¨ª«¨¢ ­¨ï
  813.         @@:
  814.                 lodsb
  815.                 cmp     al,' '
  816.                 jne     @f
  817.                 loop @b
  818.         @@:
  819.         dec esi
  820.         cmp byte[esi],'X'
  821.         jne .err_init
  822.                 inc esi
  823.                 stdcall conv_str_to_int, esi
  824.                 mov ebx,[ppoi]
  825.  
  826.                 ;Data_String <- esi
  827.                 push esi
  828.                         mov ecx,32
  829.                         mov edi,esi
  830.                         @@:
  831.                                 lodsb
  832.                                 or al,al
  833.                                 jz @f
  834.                                 cmp al,' '
  835.                                 je @f
  836.                                 cmp al,13
  837.                                 je @f
  838.                                 loop @b
  839.                         @@:
  840.                         mov esi,edi
  841.                         sub ecx,32
  842.                         neg ecx
  843.                         mov edi,Data_String
  844.                         rep movsb
  845.                         mov byte[edi],0
  846.                 pop esi
  847.                 stdcall String_to_DoubleFloat
  848.                 ;Data_Double -> Point.CoordX
  849.                 push esi
  850.                         mov esi,Data_Double
  851.                         lea edi,[ebx+Point.CoordX]
  852.                         movsd
  853.                         movsd
  854.                 pop esi
  855.  
  856.                 push edi
  857.                 mov al,'Y'
  858.                 mov ecx,80
  859.                 mov edi,esi
  860.                 repne scasb
  861.                 mov esi,edi
  862.                 pop edi
  863.                 ;Data_String <- esi
  864.                 push esi
  865.                         mov ecx,32
  866.                         mov edi,esi
  867.                         @@:
  868.                                 lodsb
  869.                                 or al,al
  870.                                 jz @f
  871.                                 cmp al,' '
  872.                                 je @f
  873.                                 cmp al,13
  874.                                 je @f
  875.                                 loop @b
  876.                         @@:
  877.                         mov esi,edi
  878.                         sub ecx,32
  879.                         neg ecx
  880.                         mov edi,Data_String
  881.                         rep movsb
  882.                         mov byte[edi],0
  883.                 pop esi
  884.                 stdcall String_to_DoubleFloat
  885.                 ;Data_Double -> Point.CoordY
  886.                 push esi
  887.                         mov esi,Data_Double
  888.                         lea edi,[ebx+Point.CoordY]
  889.                         movsd
  890.                         movsd
  891.                 pop esi
  892.  
  893.                 stdcall txt_next_line, 80
  894.                 jmp @f
  895.         .err_init:
  896.                 xor eax,eax
  897.                 jmp .end_f
  898.         @@:
  899.                 xor eax,eax
  900.                 inc eax
  901.         .end_f:
  902.         ret
  903. endp
  904.  
  905. ;input:
  906. ; icon - ­®¬¥à ¨ª®­ª¨
  907. ; level - ã஢¥­ì ¢«®¦¥­­®á⨠㧫 
  908. ; buffer - ¤®¡ ¢«ï¥¬ë¥ ¤ ­­ë¥
  909. ; pfig - 㪠§ â¥«ì ­  ¤®¡ ¢«¥­­ãî 䨣ãàã (¤«ï ª®­â஫ï á® áâ®à®­ë த¨â¥«ì᪮£® ®¡ê¥ªâ )
  910. ;output:
  911. ; eax - object data pointer
  912. align 4
  913. proc add_object_in_list uses ebx, icon:dword,level:dword,buffer:dword, pfig:dword
  914.         mov ax,word[icon]
  915.         shl eax,16
  916.         mov ax,word[level]
  917.  
  918.         stdcall [tl_node_add], tree1, eax, [buffer]
  919.         stdcall [tl_node_get_data],tree1
  920.         mov ebx,[pfig]
  921.         or ebx,ebx
  922.         jz @f
  923.                 mov [ebx],eax
  924.         @@:
  925.         stdcall [tl_cur_next], tree1
  926.         ret
  927. endp
  928.  
  929. align 4
  930. proc clear_object_in_list uses eax, buffer:dword
  931.         mov eax,[buffer]
  932.         cmp dword[eax+Object.FigCount],0 ;or Figure.PoiCount
  933.         je .end_f
  934.                 stdcall mem.Free,[eax+Object.FigData] ;or Figure.PoiData
  935.         .end_f:
  936.         ret
  937. endp
  938.  
  939. ;description:
  940. ; äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï ¢ë¡à ­­®£® ®¡ê¥ªâ 
  941. align 4
  942. proc draw_obj2d, pobj:dword
  943. locals
  944.         CentrX dd ?
  945.         CentrY dd ?
  946. endl
  947. pushad
  948.         mov ebx,[pobj]
  949.         stdcall [buf2d_clear], buf_0, [buf_0.color]
  950.         mov ecx,[ebx+Object.FigCount]
  951.         or ecx,ecx
  952.         jz .end_f
  953.         ;;jecxz .end_f
  954.                 mov edi,[ebx+Object.FigData]
  955.                 finit
  956.                 fld qword[ebx+Object.SizeY]
  957.                 fmul qword[ebx+Object.WScale]
  958.                 fmul qword[ebx+Object.MScale]
  959.                 fchs
  960.                 fistp dword[CentrY]
  961.                 mov eax,[CentrY]
  962.                 sub eax,[graf_margin_top]
  963.                 sub eax,[graf_margin_bot]
  964.                 add eax,[buf_0.h]
  965.                 sar eax,1
  966.                 add eax,[graf_margin_bot] ;_bot   ­¥ _top - ¢ á¢ï§¨ á ⥬ çâ® ª®®à¤. Y ¯¥à¥¢¥à­ãâ 
  967.                 add eax,[ebx+Object.MCentrY]
  968.                 mov [CentrY],eax
  969.                 fld qword[ebx+Object.SizeX]
  970.                 fmul qword[ebx+Object.WScale]
  971.                 fmul qword[ebx+Object.MScale]
  972.                 fchs
  973.                 fistp dword[CentrX]
  974.                 mov edx,[CentrX]
  975.                 sub edx,[graf_margin_left]
  976.                 sub edx,[graf_margin_right]
  977.                 add edx,[buf_0.w]
  978.                 sar edx,1
  979.                 add edx,[graf_margin_left]
  980.                 add edx,[ebx+Object.MCentrX]
  981.                 mov [CentrX],edx
  982. align 4
  983.                 .cycle0:
  984.                         stdcall draw_fig2d_litl, buf_0,ebx,[edi],0,edx,eax
  985.                         add edi,4
  986.                         loop .cycle0
  987.                 stdcall [buf2d_flip_v], buf_0
  988.  
  989.         bt dword[opt_draw],0
  990.         jnc .end_f
  991.                 ; draw min & sizes
  992.                 mov word[NumberSymbolsAD],8
  993.                 stdcall mem_copy, txt_buf,txt_size_x,20
  994.                 fld qword[ebx+Object.SizeX]
  995.                 fstp qword[Data_Double]
  996.                 call DoubleFloat_to_String
  997.                 call String_crop_0
  998.                 stdcall str_cat,txt_buf,Data_String
  999.                 stdcall str_cat,txt_buf,txt_n
  1000.                 stdcall str_cat,txt_buf,txt_size_y
  1001.                 fld qword[ebx+Object.SizeY]
  1002.                 fstp qword[Data_Double]
  1003.                 call DoubleFloat_to_String
  1004.                 call String_crop_0
  1005.                 stdcall str_cat,txt_buf,Data_String
  1006.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,23,0
  1007.  
  1008.                 fld qword[ebx+Object.MinX]
  1009.                 fstp qword[Data_Double]
  1010.                 stdcall mem_copy, txt_buf,txt_min_x,20
  1011.                 call DoubleFloat_to_String
  1012.                 call String_crop_0
  1013.                 stdcall str_cat,txt_buf,Data_String
  1014.                 stdcall str_cat,txt_buf,txt_n
  1015.                 stdcall str_cat,txt_buf,txt_min_y
  1016.                 fld qword[ebx+Object.MinY]
  1017.                 fstp qword[Data_Double]
  1018.                 call DoubleFloat_to_String
  1019.                 call String_crop_0
  1020.                 stdcall str_cat,txt_buf,Data_String
  1021.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,3,0
  1022.         .end_f:
  1023. popad
  1024.         ret
  1025. endp
  1026.  
  1027. align 4
  1028. proc draw_obj2d_png uses eax ebx ecx edi esi, pobj:dword
  1029.         mov ebx,[pobj]
  1030.         mov ecx,[ebx+Object.FigCount]
  1031.         cmp dword[ebx+Object.FigCount],0
  1032.         or ecx,ecx
  1033.         jz .end_f
  1034.         ;;jecxz .end_f
  1035.                 mov edi,[ebx+Object.FigData]
  1036.                 stdcall [buf2d_delete], buf_png
  1037.                 finit
  1038.                 fld qword[ebx+Object.SizeY]
  1039.                 fmul qword[Scale1mm]
  1040.                 fiadd dword[graf_margin_top]
  1041.                 fiadd dword[graf_margin_bot]
  1042.                 fistp dword[buf_png.h]
  1043.                 fld qword[ebx+Object.SizeX]
  1044.                 fmul qword[Scale1mm]
  1045.                 fiadd dword[graf_margin_left]
  1046.                 fiadd dword[graf_margin_right]
  1047.                 fistp dword[buf_png.w]
  1048.                 stdcall [buf2d_create], buf_png
  1049. align 4
  1050.                 .cycle0:
  1051.                         stdcall draw_fig2d_litl, buf_png,ebx,[edi],Scale1mm,[graf_margin_left],[graf_margin_bot] ;_bot   ­¥ _top - ¢ á¢ï§¨ á ⥬ çâ® ª®®à¤. Y ¯¥à¥¢¥à­ãâ 
  1052.                         add edi,4
  1053.                         loop .cycle0
  1054.                 stdcall [buf2d_flip_v], buf_png
  1055.         .end_f:
  1056.         ret
  1057. endp
  1058.  
  1059. ;input:
  1060. ; pbuf - pointer to buffer 2d
  1061. ;description:
  1062. ; äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï ®¡ê¥ªâ  ¯® ç áâï¬
  1063. align 4
  1064. proc draw_fig2d_litl, pbuf:dword, pobj:dword, pfig:dword, Scale:dword, CentrX:dword, CentrY:dword
  1065. locals
  1066.         PervX dd 0 ;pervios point coord X
  1067.         PervY dd 0 ;pervios point coord Y
  1068.         GrafX dd ? ;active point coord X
  1069.         GrafY dd ? ;active point coord Y
  1070. endl
  1071. pushad
  1072.         mov ebx,[pfig]
  1073.         test ebx,ebx
  1074.         jz .end_f
  1075.         mov ecx,[ebx+Figure.PoiCount]
  1076.         ;;jecxz .end_f
  1077.         test ecx,ecx
  1078.         jz .end_f
  1079.         mov edi,[ebx+Figure.PoiData]
  1080.         mov edx,[pobj]
  1081.  
  1082.         fld1
  1083.         mov eax,[Scale]
  1084.         or eax,eax
  1085.         jnz @f
  1086.                 lea eax,[edx+Object.MScale]
  1087.                 fmul qword[eax]
  1088.                 lea eax,[edx+Object.WScale]
  1089.         @@:
  1090.         fmul qword[eax]
  1091. align 4
  1092.         .cycle0:
  1093.                 fld qword[edi+Point.CoordX]
  1094.                 fsub qword[edx+Object.MinX]
  1095.                 fmul st0,st1
  1096.                 fiadd dword[CentrX]
  1097.                 fistp dword[ebp-8]
  1098.                 fld qword[edi+Point.CoordY]
  1099.                 fsub qword[edx+Object.MinY]
  1100.                 fmul st0,st1
  1101.                 fiadd dword[CentrY]
  1102.                 fistp dword[ebp-4]
  1103.                 stdcall [buf2d_set_pixel], [pbuf], [GrafX],[GrafY], 0xff0000
  1104.                 cmp ecx,[ebx+Figure.PoiCount]
  1105.                 je @f
  1106.                         stdcall [buf2d_line_sm], [pbuf], [PervX],[PervY], [GrafX],[GrafY], 0x80
  1107.                         ;sub esp,24
  1108.                         ;call [buf2d_line]
  1109.                         stdcall [buf2d_line], [pbuf], [PervX],[PervY], [GrafX],[GrafY], 0x80
  1110.                 @@:
  1111.                 mov eax,[GrafX]
  1112.                 mov [PervX],eax
  1113.                 mov eax,[GrafY]
  1114.                 mov [PervY],eax
  1115.                 add edi,sizeof.Point
  1116.         ;;loop .cycle0
  1117.                 dec ecx
  1118.         jnz .cycle0
  1119.         ffree st0
  1120.         fincstp
  1121.  
  1122.         .end_f:
  1123. popad
  1124.         ret
  1125. endp
  1126.  
  1127. ;description:
  1128. ; äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï ¢ë¡à ­­®© 䨣ãàë
  1129. align 4
  1130. proc draw_fig2d, pfig:dword
  1131. locals
  1132.         n dd 0
  1133.         col_lin dd 0 ;梥⠫¨­¨© 䨣ãàë
  1134.         CentrX dd ?
  1135.         CentrY dd ?
  1136.         PervX dd 0 ;pervios point coord X
  1137.         PervY dd 0 ;pervios point coord Y
  1138.         GrafX dd ? ;active point coord X
  1139.         GrafY dd ? ;active point coord Y
  1140.         old_tl dd 0 ;old text coord X0
  1141.         old_tt dd 0 ;old text coord Y0
  1142.         old_tw dd 0 ;old text coord X1
  1143.         old_th dd 0 ;old text coord Y1
  1144.         new_tl dd 0 ;new text coord X0
  1145.         ;new_tt dd 0 ;new text coord Y0
  1146.         new_tw dd 0 ;new text coord X1
  1147.         ;new_th dd 0 ;new text coord Y1
  1148. endl
  1149. pushad
  1150.         stdcall [buf2d_clear], buf_0, [buf_0.color]
  1151.         mov ebx,[pfig]
  1152.         test ebx,ebx
  1153.         jz .end_f
  1154.         mov ecx,[ebx+Figure.PoiCount]
  1155.         ;;jecxz .end_f
  1156.         test ecx,ecx
  1157.         jz .end_f
  1158.         mov edi,[ebx+Figure.PoiData]
  1159.         finit
  1160.         fld qword[ebx+Figure.SizeY]
  1161.         fmul qword[ebx+Figure.WScale]
  1162.         fmul qword[ebx+Figure.MScale]
  1163.         fchs
  1164.         fistp dword[CentrY]
  1165.         mov eax,[CentrY]
  1166.         sub eax,[graf_margin_top]
  1167.         sub eax,[graf_margin_bot]
  1168.         add eax,[buf_0.h]
  1169.         sar eax,1
  1170.         add eax,[graf_margin_bot]
  1171.         add eax,[ebx+Figure.MCentrY]
  1172.         mov [CentrY],eax
  1173.         ;CentrY = (-(Figure.SizeY * Figure.WScale) - graf_margin_top - graf_margin_bot + buf_0.h) / 2 + graf_margin_bot
  1174.         fld qword[ebx+Figure.SizeX]
  1175.         fmul qword[ebx+Figure.WScale]
  1176.         fmul qword[ebx+Figure.MScale]
  1177.         fchs
  1178.         fistp dword[CentrX]
  1179.         mov eax,[CentrX]
  1180.         sub eax,[graf_margin_left]
  1181.         sub eax,[graf_margin_right]
  1182.         add eax,[buf_0.w]
  1183.         sar eax,1
  1184.         add eax,[graf_margin_left]
  1185.         add eax,[ebx+Figure.MCentrX]
  1186.         mov [CentrX],eax       
  1187.         ;CentrX = (-(Figure.SizeX * Figure.WScale) - graf_margin_left - graf_margin_right + buf_0.w) / 2 + graf_margin_left
  1188.  
  1189. align 4
  1190.         .cycle0:
  1191.                 fld qword[edi+Point.CoordX]
  1192.                 fsub qword[ebx+Figure.MinX]
  1193.                 fmul qword[ebx+Figure.WScale]
  1194.                 fmul qword[ebx+Figure.MScale]
  1195.                 fiadd dword[CentrX]
  1196.                 fistp dword[GrafX]
  1197.                 ;GrafX = (Point.CoordX - Figure.MinX) * Figure.WScale + CentrX
  1198.                 fld qword[edi+Point.CoordY]
  1199.                 fsub qword[ebx+Figure.MinY]
  1200.                 fmul qword[ebx+Figure.WScale]
  1201.                 fmul qword[ebx+Figure.MScale]
  1202.                 fiadd dword[CentrY]
  1203.                 fisub dword[buf_0.h] ;invert coord Y
  1204.                 fchs
  1205.                 fistp dword[GrafY]
  1206.                 ;GrafY = -((Point.CoordY - Figure.MinY) * Figure.WScale + CentrY - buf_0.h)
  1207.  
  1208.                 stdcall [buf2d_set_pixel], buf_0, [GrafX],[GrafY], 0xff0000
  1209.                 mov dword[col_lin],0x80
  1210.                 bt dword[edi+Point.Prop],PROP_BIT_SELECT
  1211.                 jnc @f
  1212.                         stdcall [buf2d_circle], buf_0, [GrafX],[GrafY], 3, 0xff0000
  1213.                 @@:
  1214.                 cmp ecx,[ebx+Figure.PoiCount]
  1215.                 je @f
  1216.                         stdcall [buf2d_line_sm], buf_0, [PervX],[PervY], [GrafX],[GrafY], [col_lin]
  1217.                         stdcall [buf2d_line], buf_0, [PervX],[PervY], [GrafX],[GrafY], [col_lin]
  1218.                 @@:
  1219.                 mov eax,[GrafX]
  1220.                 mov [PervX],eax
  1221.                 mov edx,[GrafY]
  1222.                 mov [PervY],edx
  1223.                 add edi,sizeof.Point
  1224.  
  1225.                 bt dword[opt_draw],0
  1226.                 jnc .end0
  1227.                 ; draw number points
  1228.                 ;mov eax,[GrafX]
  1229.                 ;mov edx,[GrafY]
  1230.                 add eax,2
  1231.                 add edx,2
  1232.                 push eax edi
  1233.                         mov eax,[n]
  1234.                         mov edi,txt_buf
  1235.                         stdcall convert_int_to_str,20
  1236.                 pop edi eax
  1237.  
  1238.                 inc dword[n]
  1239.                 ;calculate new text coords
  1240.                 mov [new_tl],eax
  1241.                 mov esi,eax
  1242.                 stdcall str_len,txt_buf
  1243.                 imul eax,[buf_1.w]
  1244.                 add eax,esi
  1245.                 mov [new_tw],eax
  1246.                 ;rect compare coords
  1247.                 cmp [old_tl],eax
  1248.                 jg .no_comp
  1249.                 cmp [old_tw],esi
  1250.                 jl .no_comp
  1251.                         ;calculate new text coord Y1
  1252.                         mov esi,edx
  1253.                         add esi,[font_h]
  1254.                 cmp [old_tt],esi
  1255.                 jg .no_comp
  1256.                 cmp [old_th],edx
  1257.                 ;jl .no_comp
  1258.                         ;jmp .end0
  1259.                 jge .end0
  1260.                 .no_comp:
  1261.                         mov eax,[new_tl]
  1262.                         mov [old_tl],eax
  1263.                         mov eax,[new_tw]
  1264.                         mov [old_tw],eax
  1265.                         mov [old_tt],edx
  1266.                         add edx,[font_h]
  1267.                         mov [old_th],edx
  1268.                         stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,[old_tl],[old_tt],0x000000
  1269.                 .end0:
  1270.                 dec ecx
  1271.         jnz .cycle0
  1272.  
  1273.         stdcall sel_points_get_count,[pfig]
  1274.         or eax,eax
  1275.         jz .no_point
  1276.                 stdcall mem_copy, txt_buf,txt_poi_sel,txt_poi_sel.end-txt_poi_sel
  1277.                 mov edi,txt_buf+txt_poi_sel.end-txt_poi_sel
  1278.                 stdcall convert_int_to_str, 20
  1279.                 mov word[NumberSymbolsAD],8
  1280.                 cmp eax,1
  1281.                 jne @f
  1282.                         ;¥á«¨ ¢ë¡à ­  ®¤­  â®çª , â® ¯® ­¥© ¢ë¢®¤ ¡®«¥¥ ¤¥â «ì­®© ¨­ä®à¬ æ¨¨
  1283.                         stdcall sel_points_get_first,[pfig]
  1284.                         stdcall str_cat,txt_buf,txt_ls
  1285.                         fld qword[eax+Point.CoordX]
  1286.                         fstp qword[Data_Double]
  1287.                         call DoubleFloat_to_String
  1288.                         call String_crop_0
  1289.                         stdcall str_cat,txt_buf,Data_String
  1290.                         stdcall str_cat,txt_buf,txt_coma
  1291.                         fld qword[eax+Point.CoordY]
  1292.                         fstp qword[Data_Double]
  1293.                         call DoubleFloat_to_String
  1294.                         call String_crop_0
  1295.                         stdcall str_cat,txt_buf,Data_String
  1296.                         stdcall str_cat,txt_buf,txt_rs
  1297.                         jmp .end1
  1298.                 @@:
  1299.                 cmp eax,2
  1300.                 jne .end1
  1301.                         ;¥á«¨ ¢ë¡à ­® 2 â®çª¨
  1302.                         stdcall sel_points_get_first,[pfig]
  1303.                         fld qword[eax+Point.CoordX]
  1304.                         fld qword[eax+Point.CoordY]
  1305.                         stdcall sel_points_get_last,[pfig]
  1306.                         fsub qword[eax+Point.CoordY]
  1307.                         fmul st0,st0
  1308.                         fxch st1
  1309.                         fsub qword[eax+Point.CoordX]
  1310.                         fmul st0,st0
  1311.                         faddp st1,st0
  1312.                         fsqrt
  1313.                         fstp qword[Data_Double]
  1314.                         call DoubleFloat_to_String
  1315.                         call String_crop_0
  1316.                         stdcall str_cat,txt_buf,txt_len
  1317.                         stdcall str_cat,txt_buf,Data_String
  1318.                 .end1:
  1319.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,3,0
  1320.                 jmp .end_f ;­¥ ¢ë¢®¤¨¬ ¨­ä®à¬ æ¨î ® à §¬¥à å
  1321.         .no_point:
  1322.  
  1323.         bt dword[opt_draw],0
  1324.         jnc .end_f
  1325.                 ; draw min & sizes
  1326.                 mov word[NumberSymbolsAD],8
  1327.                 stdcall mem_copy, txt_buf,txt_size_x,20
  1328.                 fld qword[ebx+Figure.SizeX]
  1329.                 fstp qword[Data_Double]
  1330.                 call DoubleFloat_to_String
  1331.                 call String_crop_0
  1332.                 stdcall str_cat,txt_buf,Data_String
  1333.                 stdcall str_cat,txt_buf,txt_n
  1334.                 stdcall str_cat,txt_buf,txt_size_y
  1335.                 fld qword[ebx+Figure.SizeY]
  1336.                 fstp qword[Data_Double]
  1337.                 call DoubleFloat_to_String
  1338.                 call String_crop_0
  1339.                 stdcall str_cat,txt_buf,Data_String
  1340.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,23,0
  1341.  
  1342.                 fld qword[ebx+Figure.MinX]
  1343.                 fstp qword[Data_Double]
  1344.                 stdcall mem_copy, txt_buf,txt_min_x,20
  1345.                 call DoubleFloat_to_String
  1346.                 call String_crop_0
  1347.                 stdcall str_cat,txt_buf,Data_String
  1348.                 stdcall str_cat,txt_buf,txt_n
  1349.                 stdcall str_cat,txt_buf,txt_min_y
  1350.                 fld qword[ebx+Figure.MinY]
  1351.                 fstp qword[Data_Double]
  1352.                 call DoubleFloat_to_String
  1353.                 call String_crop_0
  1354.                 stdcall str_cat,txt_buf,Data_String
  1355.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,3,0
  1356.         .end_f:
  1357. popad
  1358.         ret
  1359. endp
  1360.  
  1361. ;input:
  1362. ; pnode - 㪠§ â¥«ì ­  ¤ ­­ë¥ 㧫 
  1363. align 4
  1364. proc get_object_data, pnode:dword
  1365.         mov ecx,[pnode]
  1366.         cmp [ecx+Object.OType],'Obj'
  1367.         jne .end0
  1368.                 mov ecx,ObjData
  1369.                 jmp .end_f
  1370.         .end0:
  1371.                 xor ecx,ecx
  1372.         .end_f:
  1373.         ret
  1374. endp
  1375.  
  1376. ;input:
  1377. ; pfig - pointer to figure
  1378. ;output:
  1379. ; eax - 㪠§ â¥«ì ­  த¨â¥«ì᪨© ®¡ê¥ªâ ¨«¨ 0 ¥á«¨ ­¥ ­ ©¤¥­®
  1380. ; ecx - ­®¬¥à 䨣ãàë ¢­ãâਠ®¡ê¥ªâ 
  1381. align 4
  1382. proc found_parent_obj uses ebx edx edi, pfig:dword
  1383.         mov eax,ObjData
  1384.         mov edx,[eax+Object.FigCount]
  1385.         or edx,edx
  1386.         jz .cycle1end
  1387.         mov edi,[eax+Object.FigData]
  1388.         xor ecx,ecx
  1389.         .cycle1: ;横« ¯® 䨣ãà ¬
  1390.                 mov ebx,[edi]
  1391.                 cmp ebx,[pfig]
  1392.                 je .end_f ;¥á«¨ ­ ©¤¥­®
  1393.                 add edi,4
  1394.                 inc ecx
  1395.                 dec edx
  1396.                 jnz .cycle1
  1397.         .cycle1end:
  1398.         xor eax,eax
  1399.         .end_f:
  1400.         ret
  1401. endp
  1402.  
  1403. ;description:
  1404. ; áç¨â ¥â ª®««¨ç¥á⢮ ¢ë¤¥«¥­­ëå â®ç¥ª
  1405. align 4
  1406. proc sel_points_get_count uses ebx ecx, pFig:dword
  1407.         xor eax,eax
  1408.         mov ebx,[pFig]
  1409.         mov ecx,[ebx+Figure.PoiCount]
  1410.         or ecx,ecx
  1411.         jz .no_point
  1412.         mov ebx,[ebx+Figure.PoiData]
  1413.         .cycle0:
  1414.                 bt dword[ebx+Point.Prop],PROP_BIT_SELECT
  1415.                 jnc @f
  1416.                         inc eax
  1417.                 @@:
  1418.                 add ebx,sizeof.Point
  1419.                 loop .cycle0
  1420.         .no_point:
  1421.         ret
  1422. endp
  1423.  
  1424. ;description:
  1425. ; ¡¥à¥â 㪠§ â¥«ì ­  ¯¥à¢ãî ¢ë¤¥«¥­­ãî â®çªã
  1426. ;output:
  1427. ; eax - 㪠§ â¥«ì ­  â®çªã ¨«¨ 0 ¥á«¨ ­¥ ¢ë¤¥«¥­­®
  1428. align 4
  1429. proc sel_points_get_first uses ecx, pFig:dword
  1430.         mov eax,[pFig]
  1431.         mov ecx,[eax+Figure.PoiCount]
  1432.         or ecx,ecx
  1433.         jz .no_point
  1434.         mov eax,[eax+Figure.PoiData]
  1435.         .cycle0:
  1436.                 bt dword[eax+Point.Prop],PROP_BIT_SELECT
  1437.                 jc .end_f
  1438.                 add eax,sizeof.Point
  1439.                 loop .cycle0
  1440.         .no_point:
  1441.         xor eax,eax
  1442.         .end_f:
  1443.         ret
  1444. endp
  1445.  
  1446. ;input:
  1447. ; pObj - 㪠§ â¥«ì ­  ®¡ê¥ªâ
  1448. ; FigN - ­®¬¥à ª®¬¬ ­¤ë
  1449. ;description:
  1450. ; ¯¥à¥áç¥â 䨣ãà ¯®á«¥ ®¡­®¢«¥­¨ï ª®®à¤¨­ â â®çª¨
  1451. align 4
  1452. proc figure_update_coords uses eax ecx edx, pObj:dword, FigN:dword
  1453.         mov eax,[pObj]
  1454.         mov ecx,[eax+Object.FigCount]
  1455.         mov eax,[eax+Object.FigData]
  1456.         mov edx,[FigN]
  1457.         cmp ecx,edx
  1458.         jle @f
  1459.                 stdcall FigCalculateSizes,[eax+4*edx],1
  1460.                 stdcall ObjCalculateScale,[pObj]
  1461.         @@:
  1462.         ret
  1463. endp
  1464.  
  1465. ;description:
  1466. ; ¡¥à¥â 㪠§ â¥«ì ­  ¯®á«¥¤­îî ¢ë¤¥«¥­­ãî â®çªã
  1467. align 4
  1468. proc sel_points_get_last uses ebx ecx, pFig:dword
  1469.         mov ebx,[pFig]
  1470.         mov ecx,[ebx+Figure.PoiCount]
  1471.         or ecx,ecx
  1472.         jz .no_point
  1473.         mov eax,ecx
  1474.         dec eax
  1475.         imul eax,sizeof.Point
  1476.         add eax,[ebx+Figure.PoiData]
  1477.         .cycle0:
  1478.                 bt dword[eax+Point.Prop],PROP_BIT_SELECT
  1479.                 jc .end_f
  1480.                 sub eax,sizeof.Point
  1481.                 loop .cycle0
  1482.         .no_point:
  1483.         xor eax,eax
  1484.         .end_f:
  1485.         ret
  1486. endp
  1487.  
  1488. ;description:
  1489. ; á­¨¬ ¥â ¢ë¤¥«¥­¨¥ á â®ç¥ª
  1490. align 4
  1491. proc sel_points_clear uses ebx ecx, pFig:dword
  1492.         mov ebx,[pFig]
  1493.         mov ecx,[ebx+Figure.PoiCount]
  1494.         or ecx,ecx
  1495.         jz .no_point
  1496.         mov ebx,[ebx+Figure.PoiData]
  1497.         .cycle0:
  1498.                 btr dword[ebx+Point.Prop],PROP_BIT_SELECT
  1499.                 add ebx,sizeof.Point
  1500.                 loop .cycle0
  1501.         .no_point:
  1502.         ret
  1503. endp
  1504.  
  1505. ;description:
  1506. ; ¨­¢¥àâ¨àã¥â 㪠§ ­­ë© ¡¨â ¢ ᢮©áâ¢ å ¢ë¤¥«¥­­ëå â®ç¥ª
  1507. align 4
  1508. proc sel_points_invert_bit uses eax ebx ecx, pFig:dword, iBit:dword
  1509.         mov ecx,[iBit]
  1510.         xor eax,eax
  1511.         inc eax
  1512.         shl eax,cl
  1513.         mov ebx,[pFig]
  1514.         mov ecx,[ebx+Figure.PoiCount]
  1515.         or ecx,ecx
  1516.         jz .no_point
  1517.         mov ebx,[ebx+Figure.PoiData]
  1518.         .cycle0:
  1519.                 bt dword[ebx+Point.Prop],PROP_BIT_SELECT
  1520.                 jnc @f
  1521.                         xor dword[ebx+Point.Prop],eax
  1522.                 @@:
  1523.                 add ebx,sizeof.Point
  1524.                 loop .cycle0
  1525.         .no_point:
  1526.         ret
  1527. endp
  1528.  
  1529. ;description:
  1530. ; ®¯â¨¬¨§ æ¨ï 䨣ãàë, ¢ë¤¥«ï¥â «¨è­¨¥ â®çª¨ (1-ï ¨ ¯®á«¥¤­ïï â®çª¨ ­¥ ãç¨â뢠îâáï)
  1531. align 4
  1532. proc points_optimize uses eax ebx ecx, pFig:dword
  1533.         mov ebx,[pFig]
  1534.         mov ecx,[ebx+Figure.PoiCount]
  1535.         cmp ecx,3
  1536.         jl .no_point
  1537.         sub ecx,2 ;®â­¨¬ ¥¬ â®çª¨ ª®â®àë¥ ­¥ ãç¨â뢠îâáï
  1538.         stdcall sel_points_clear,ebx
  1539.         mov ebx,[ebx+Figure.PoiData]
  1540.         finit
  1541.         .cycle0:
  1542.                 ;calc (x0-x1)/(x0-x2)
  1543.                 fld qword[ebx+Point.CoordX]
  1544.                 add ebx,sizeof.Point
  1545.                 fcom qword[ebx+Point.CoordX]
  1546.                 fstsw ax
  1547.                 sahf
  1548.                 jne @f
  1549.                         fcomp qword[ebx+sizeof.Point+Point.CoordX]
  1550.                         fstsw ax
  1551.                         sahf
  1552.                         jne .no_sel ;if( (x0==x1) && (x0!=x2) )
  1553.                         jmp .sel    ;if( x0==x1==x2 )
  1554.                 @@:
  1555.                 fld st0
  1556.                 fsub qword[ebx+Point.CoordX]
  1557.                 fxch st1
  1558.                 fsub qword[ebx+sizeof.Point+Point.CoordX]
  1559.                 fdivp
  1560.  
  1561.                 ;calc (y0-y1)/(y0-y2)
  1562.                 fld qword[ebx-sizeof.Point+Point.CoordY]
  1563.                 fcom qword[ebx+Point.CoordY]
  1564.                 fstsw ax
  1565.                 sahf
  1566.                 jne @f
  1567.                         fcomp qword[ebx+sizeof.Point+Point.CoordY]
  1568.                         fstsw ax
  1569.                         ffree st0 ;free (x0-x1)/(x0-x2)
  1570.                         fincstp
  1571.                         sahf
  1572.                         jne .no_sel ;if( (y0==y1) && (y0!=y2) )
  1573.                         jmp .sel    ;if( y0==y1==y2 )
  1574.                 @@:
  1575.                 fld st0
  1576.                 fsub qword[ebx+Point.CoordY]
  1577.                 fxch st1
  1578.                 fsub qword[ebx+sizeof.Point+Point.CoordY]
  1579.                 fdivp
  1580.  
  1581.                 fsubp
  1582.                 fabs
  1583.                 fcomp qword[opt_koef] ;if( abs((x0-x1)/(x0-x2)-(y0-y1)/(y0-y2)) > 0.02)
  1584.                 fstsw ax
  1585.                 sahf
  1586.                 jae .no_sel
  1587.                 .sel:
  1588.                         bts dword[ebx+Point.Prop],PROP_BIT_SELECT
  1589.                 .no_sel:
  1590.                 loop .cycle0
  1591.         .no_point:
  1592.         ret
  1593. endp
  1594.  
  1595. ;input:
  1596. ; pPoi - 㪠§ â¥«ì ­  ¤ ­­ë¥ â®çª¨
  1597. align 4
  1598. proc point_move_up, pObj:dword,pFig:dword,idFig:dword,pPoi:dword
  1599. pushad
  1600.         ;¨§¬¥­¥­¨¥ ááë«®ª ­  â®çª¨
  1601.         mov eax,[pObj]
  1602.         mov ecx,[idFig]
  1603.         mov edx,[eax+Object.FigCount]
  1604.         or edx,edx
  1605.         jz .end_f
  1606.         mov edi,[eax+Object.FigData]
  1607.  
  1608.         ;¬¥­ï¥¬ â®çª¨ ¬¥áâ ¬¨
  1609.         mov ecx,sizeof.Point
  1610.         mov esi,[pPoi]
  1611.         sub esi,ecx
  1612.         mov edi,PoiData
  1613.         rep movsb ;p(-1) > p_s
  1614.         mov ecx,sizeof.Point
  1615.         mov edi,[pPoi]
  1616.         sub edi,ecx
  1617.         rep movsb ;p(0) > p(-1)
  1618.         mov esi,PoiData
  1619.         mov ecx,sizeof.Point
  1620.         rep movsb ;p_s > p(0)
  1621.         .end_f:
  1622. popad
  1623.         ret
  1624. endp
  1625.  
  1626. align 4
  1627. proc mouse_left_d uses eax ebx
  1628.         stdcall [tl_node_get_data],tree1
  1629.         or eax,eax
  1630.         jz .end_f
  1631.  
  1632.         cmp [eax+Figure.OType],'Fig'
  1633.         je @f
  1634.         cmp [eax+Figure.OType],'Obj'
  1635.         jne .end_f
  1636.                 mov eax,ObjData
  1637.         @@:
  1638.         call buf_get_mouse_coord
  1639.         cmp eax,-1
  1640.         je .end_f
  1641.                 mov [mouse_down_x],eax
  1642.                 mov [mouse_down_y],ebx
  1643.         .end_f:
  1644.         ret
  1645. endp
  1646.  
  1647. align 4
  1648. proc mouse_left_u uses eax ebx ecx
  1649.         stdcall [tl_node_get_data],tree1
  1650.         or eax,eax
  1651.         jz .end_f
  1652.  
  1653.         cmp [eax+Figure.OType],'Fig'
  1654.         je @f
  1655.         cmp [eax+Figure.OType],'Obj'
  1656.         jne .end_f
  1657.                 mov eax,ObjData
  1658.         @@:
  1659.         mov ecx,eax
  1660.  
  1661.         call buf_get_mouse_coord
  1662.         cmp eax,-1
  1663.         je .end_f
  1664.                 sub eax,[mouse_down_x]
  1665.                 sub ebx,[mouse_down_y]
  1666.                 add [ecx+Figure.MCentrX],eax
  1667.                 sub [ecx+Figure.MCentrY],ebx
  1668.                 mov dword[offs_last_timer],0
  1669.         .end_f:
  1670.         ret
  1671. endp
  1672.  
  1673. ;output:
  1674. ; eax, ebx - ¯®àâïâáï
  1675. align 4
  1676. proc mouse_right_d uses ecx edx edi
  1677. locals
  1678.         BufX dd ?
  1679.         BufY dd ?
  1680.         CentrX dd ?
  1681.         CentrY dd ?
  1682.         GrafX dd ? ;active point coord X
  1683.         GrafY dd ? ;active point coord Y
  1684. endl
  1685.         call buf_get_mouse_coord
  1686.         cmp eax,-1
  1687.         je .end_f
  1688.         mov [BufX],eax
  1689.         mov [BufY],ebx
  1690.  
  1691.         ;¯à®á¬ âਢ ¥¬ ¢ë¤¥«¥­­ë© ¡«®ª ¤ ­­ëå
  1692.         stdcall [tl_node_get_data],tree1
  1693.         or eax,eax
  1694.         jz .end_f
  1695.  
  1696.         cmp [eax+Figure.OType],'Fig'
  1697.         jne .end_fblo
  1698.  
  1699.         mov ecx,eax
  1700.         mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS ;¯à®¢¥àª  Shift
  1701.         bt eax,0
  1702.         jc @f
  1703.         bt eax,1
  1704.         jc @f
  1705.                 ;¥á«¨ ­¥ ­ ¦ â Shift
  1706.                 stdcall sel_points_clear,ecx
  1707.         @@:
  1708.         mov ebx,ecx
  1709.         mov ecx,[ebx+Figure.PoiCount]
  1710.         ;;jecxz .end_f
  1711.         test ecx,ecx
  1712.         jz .end_f
  1713.  
  1714.         mov edi,[ebx+Figure.PoiData]
  1715.         finit
  1716.         fld qword[ebx+Figure.SizeY]
  1717.         fmul qword[ebx+Figure.WScale]
  1718.         fmul qword[ebx+Figure.MScale]
  1719.         fchs
  1720.         fistp dword[CentrY]
  1721.         mov eax,[CentrY]
  1722.         sub eax,[graf_margin_top]
  1723.         sub eax,[graf_margin_bot]
  1724.         add eax,[buf_0.h]
  1725.         sar eax,1
  1726.         add eax,[graf_margin_bot]
  1727.         add eax,[ebx+Figure.MCentrY]
  1728.         mov [CentrY],eax
  1729.         fld qword[ebx+Figure.SizeX]
  1730.         fmul qword[ebx+Figure.WScale]
  1731.         fmul qword[ebx+Figure.MScale]
  1732.         fchs
  1733.         fistp dword[CentrX]
  1734.         mov eax,[CentrX]
  1735.         sub eax,[graf_margin_left]
  1736.         sub eax,[graf_margin_right]
  1737.         add eax,[buf_0.w]
  1738.         sar eax,1
  1739.         add eax,[graf_margin_left]
  1740.         add eax,[ebx+Figure.MCentrX]
  1741.         mov [CentrX],eax
  1742.  
  1743. align 4
  1744.         .cycle0:
  1745.                 fld qword[edi+Point.CoordX]
  1746.                 fsub qword[ebx+Figure.MinX]
  1747.                 fmul qword[ebx+Figure.WScale]
  1748.                 fmul qword[ebx+Figure.MScale]
  1749.                 fiadd dword[CentrX]
  1750.                 fistp dword[GrafX]
  1751.                 fld qword[edi+Point.CoordY]
  1752.                 fsub qword[ebx+Figure.MinY]
  1753.                 fmul qword[ebx+Figure.WScale]
  1754.                 fmul qword[ebx+Figure.MScale]
  1755.                 fiadd dword[CentrY]
  1756.                 fisub dword[buf_0.h] ;invert coord Y
  1757.                 fchs
  1758.                 fistp dword[GrafY]
  1759.  
  1760.                 mov eax,[GrafX]
  1761.                 sub eax,[BufX]
  1762.                 bt eax,31
  1763.                 jnc @f
  1764.                         neg eax
  1765.                 @@:
  1766.                 mov edx,[GrafY]
  1767.                 sub edx,[BufY]
  1768.                 bt edx,31
  1769.                 jnc @f
  1770.                         neg edx
  1771.                 @@:
  1772.                 add eax,edx
  1773.                 cmp eax,7 ;¯à¨¡«¨§¨â¥«ì­®¥ à ááâ®ï­¨¥ ¤® â®çª¨
  1774.                 jg @f
  1775.                         ;¢ë¤¥«ï¥¬ ¨«¨ á­¨¬ ¥¬ ¢ë¤¥«¥­¨¥ á â®ç¥ª
  1776.                         xor dword[edi+Point.Prop],(1 shl PROP_BIT_SELECT)
  1777.                 @@:
  1778.  
  1779.                 add edi,sizeof.Point
  1780.                 dec ecx
  1781.         jnz .cycle0
  1782.  
  1783.                 mov dword[offs_last_timer],0
  1784.                 ;jmp .end_f
  1785.         .end_fblo:
  1786.  
  1787.         .end_f:
  1788.         ret
  1789. endp
  1790.