Subversion Repositories Kolibri OS

Rev

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_preview db 'à¥¤¯à®á¬®âà १ã«ìâ â :',0
  64. txt_port db '®àâ:',0
  65. txt_but_cancel db 'Žâ¬¥­ ',0
  66. txt_but_run db '‚믮«­¨âì',0
  67. txt_size_x db 'à §¬¥à x: ',0
  68. txt_size_y db 'à §¬¥à y: ',0
  69. txt_command:
  70.   db 'Š®¬ ­¤ :', 0
  71.   .end:
  72. txt_filename:
  73.   db '” ©« (¯®«­ë© ¯ãâì):', 0
  74.   .end:
  75. else
  76. ;
  77. ; eng
  78. ;
  79. txt_preview db 'Preview:',0
  80. txt_port db 'Port:',0
  81. txt_but_cancel db 'Cancel',0
  82. txt_but_run db 'Run',0
  83. txt_size_x db 'size x: ',0
  84. txt_size_y db 'size y: ',0
  85. txt_command:
  86.   db 'Command:', 0
  87.   .end:
  88. txt_filename:
  89.   db 'Full file name (path):', 0
  90.   .end:
  91. end if
  92.  
  93. align 4
  94. txt_s_poi db 'X',0
  95. txt_s_poi_Y db ' Y',0
  96. txt_s_poi_Z db ' Z',0
  97. txt_n db 13,0
  98.  
  99. align 4
  100. zoom_plus dq 1.25992105
  101. mouse_prop_x dd 0 ;ªãàá®à ¬ëè¨ ®â­®á¨â¥«ì­® 業âà  ®ª­  buf_0 (¤«ï ¨§¬¥­. ¬ áèâ ¡ )
  102. mouse_prop_y dd 0
  103. mouse_down_x dd 0 ;ªãàá®à ¬ëè¨ ®â­®á¨â¥«ì­® «¥¢®£® ¢¥àå­¥£® 㣫  ®ª­  buf_0 (¤«ï ᤢ¨£  䨣ãàë)
  104. mouse_down_y dd 0
  105. opt_draw  dd 1
  106. graf_margin_left   dd 3 ;margin in pixels
  107. graf_margin_right  dd 3+6 ;margin in pixels
  108. graf_margin_top    dd 3+9 ;margin in pixels
  109. graf_margin_bot    dd 3+9 ;margin in pixels
  110. png_data dd ?
  111. png_size dd ?
  112.  
  113. ;global variables:
  114. ObjData Object
  115. FigData Figure ;¢à¥¬¥­­ ï áâàãªâãà  ¤«ï § ¯®«­¥­¨ï tree1
  116. PoiData Point
  117.  
  118. size_one_list equ sizeof.Figure ;max (sizeof.Figure, sizeof.Object)
  119.  
  120. if sizeof.Object > sizeof.Figure
  121.    ... need fix size_one_list
  122. end if
  123.  
  124. if (Object.FigCount <> Figure.PoiCount) | (Object.FigData <> Figure.PoiData) | (Object.MScale <> Figure.MScale) | (Object.MCentrX <> Figure.MCentrX) | (Object.MCentrY <> Figure.MCentrY)
  125.    ... need fix offsets
  126. end if
  127.        
  128. txt_buf rb 80 ;???
  129. txt_sp db ' ',0
  130.  
  131. ;input:
  132. ; esi - text pointer
  133. align 4
  134. proc txt_next_line uses eax ecx edi, mlen:dword
  135.         mov al,13
  136.         mov ecx,[mlen]
  137.         mov edi,esi
  138.         repne scasb
  139.         cmp byte[edi],10
  140.         jne @f
  141.                 inc edi
  142.         @@:
  143.         mov esi,edi
  144.         ret
  145. endp
  146.  
  147. ;input:
  148. ; edi - destination buffer
  149. ; esi - source text string: '...\nl
  150. ; mlen - maximum len destination buffer
  151. align 4
  152. proc txt_load_line uses eax ebx ecx esi, mlen:dword
  153.         mov byte[edi],0
  154.         mov al,13
  155.         cmp byte[esi],al
  156.         je .end_f
  157.                 mov ecx,[mlen]
  158.                 mov ebx,edi
  159.                 mov edi,esi
  160.                 repne scasb ;found end of string
  161.                 mov ecx,edi
  162.                 sub ecx,esi
  163.                 dec ecx ;ecx = string len
  164.                 mov edi,ebx
  165.                 rep movsb ;copy caption string
  166.                 cmp byte[esi],13
  167.                 je @f
  168.                 .cycle0:
  169.                         inc esi
  170.                         cmp byte[esi],13
  171.                         jne .cycle0
  172.                 @@:
  173.                 mov byte[edi],0
  174.                 inc esi
  175.         .end_f:
  176.         ret
  177. endp
  178.  
  179. ;input:
  180. ; itxt - input description text
  181. ; msize - max size
  182. align 4
  183. proc FileInit uses eax ebx ecx edi esi, itxt:dword, msize:dword
  184.         cmp dword[ObjData.FigData],0
  185.         je @f
  186.         cmp dword[ObjData.FigCount],0 ;or Figure.PoiCount
  187.         je @f
  188.                 stdcall mem.Free,[ObjData.FigData] ;or Figure.PoiData
  189.         @@:
  190.         mov dword[offs_last_timer],0
  191.  
  192.         mov esi,[itxt]
  193.         mov ebx,esi
  194.         add ebx,[msize]
  195.         stdcall ObjectInit,ObjData,ebx
  196.         ret
  197. endp
  198.  
  199. ;input:
  200. ; esi - input description text
  201. ; pobj - pointer to object struct
  202. ; etxt - pointer to end of input text
  203. align 4
  204. proc ObjectInit uses eax ebx ecx edi, pobj:dword, etxt:dword
  205.                 mov ebx,[pobj]
  206.                 mov [ebx+Object.OType],'Obj'
  207.                 mov edi,ebx
  208.                 add edi,Object.Caption
  209.                 mov dword[edi],'CNC'
  210.  
  211.                 stdcall get_max_lines
  212.                 test eax,eax
  213.                 jz .err_init
  214.                 mov [ebx+Object.FigCount],eax
  215.                 mov ecx,eax
  216.  
  217.                 shl eax,2
  218.                 stdcall mem.Alloc,eax
  219.                 mov [ebx+Object.FigData],eax
  220.                 push ecx
  221.                         mov edi,eax
  222.                         xor eax,eax
  223.                         rep stosd ;clear memory
  224.                 pop ecx
  225.  
  226.                 mov edi,[ebx+Object.FigData]
  227. align 4
  228.                 .cycle0:
  229.                         stdcall FigureInit,edi
  230.                         cmp esi,[etxt]
  231.                         jge .cycle0end
  232.                         add edi,4
  233.                 loop .cycle0
  234.                 .cycle0end:
  235.                 inc dword[ebx+Object.FigCount] ;???
  236.                 or ecx,ecx
  237.                 jz @f
  238.                         ;㬥­ìè ¥¬ ®¡ê¥¬ ¯ ¬ï⨠¢ë¤¥«¥­­ë© ¤«ï ª®¬ ­¤
  239.                         sub [ebx+Object.FigCount],ecx
  240.                         mov eax,[ebx+Object.FigCount]
  241.                         shl eax,2
  242.                         stdcall mem.ReAlloc,[ebx+Object.FigData],eax
  243.                         mov [ebx+Object.FigData],eax
  244.                 @@:
  245.  
  246.                 stdcall ObjCalculateScale,ebx
  247.  
  248.                 jmp .end_f
  249.         .err_init:
  250.                 notify_window_run txt_err_1
  251.         .end_f:
  252.         ret
  253. endp
  254.  
  255. align 4
  256. proc ObjCalculateScale uses eax ebx ecx edi, pobj:dword
  257.         mov ebx,[pobj]
  258.  
  259.         ;*** Calculate scale for object ***
  260.         finit
  261.  
  262.         ;found min coord X
  263.         mov ecx,[ebx+Object.FigCount]
  264.         jecxz .cycle2end
  265.         mov edi,[ebx+Object.FigData]
  266.         @@:
  267.                 mov eax,[edi]
  268.                 dec ecx
  269.                 jecxz .cycle2end
  270.                 add edi,4
  271.                 or eax,eax
  272.                 jz @b
  273.                 cmp [eax+Figure.PoiCount],0
  274.                 je @b
  275.         push edi esi ;copy first min X
  276.                 lea esi,[eax+Figure.MinX]
  277.                 lea edi,[ebx+Object.MinX]
  278.                 movsd
  279.                 movsd
  280.         pop esi edi
  281. align 4
  282.         .cycle2:
  283.                 mov eax,[edi]
  284.                 or eax,eax
  285.                 jz @f
  286.                 cmp [eax+Figure.PoiCount],0
  287.                 je @f
  288.                 fld qword[eax+Figure.MinX]
  289.                 fcomp qword[ebx+Object.MinX]
  290.                 fstsw ax
  291.                 sahf
  292.                 jae @f
  293.                         push edi esi
  294.                         mov eax,[edi]
  295.                         lea esi,[eax+Figure.MinX]
  296.                         lea edi,[ebx+Object.MinX]
  297.                         movsd
  298.                         movsd
  299.                         pop esi edi
  300.                 @@:
  301.                 add edi,4
  302.         loop .cycle2
  303.         .cycle2end:
  304.  
  305.         ;found min coord Y
  306.         mov ecx,[ebx+Object.FigCount]
  307.         jecxz .cycle3end
  308.         mov edi,[ebx+Object.FigData]
  309.         @@:
  310.                 mov eax,[edi]
  311.                 dec ecx
  312.                 jecxz .cycle3end
  313.                 add edi,4
  314.                 or eax,eax
  315.                 jz @b
  316.                 cmp [eax+Figure.PoiCount],0
  317.                 je @b
  318.         push edi esi ;copy first min Y
  319.                 lea esi,[eax+Figure.MinY]
  320.                 lea edi,[ebx+Object.MinY]
  321.                 movsd
  322.                 movsd
  323.         pop esi edi
  324. align 4
  325.         .cycle3:
  326.                 mov eax,[edi]
  327.                 or eax,eax
  328.                 jz @f
  329.                 cmp [eax+Figure.PoiCount],0
  330.                 je @f
  331.                 fld qword[eax+Figure.MinY]
  332.                 fcomp qword[ebx+Object.MinY]
  333.                 fstsw ax
  334.                 sahf
  335.                 jae @f
  336.                         push edi esi
  337.                         mov eax,[edi]
  338.                         lea esi,[eax+Figure.MinY]
  339.                         lea edi,[ebx+Object.MinY]
  340.                         movsd
  341.                         movsd
  342.                         pop esi edi
  343.                 @@:
  344.                 add edi,4
  345.         loop .cycle3
  346.         .cycle3end:
  347.  
  348.         ;found max coord X
  349.         mov ecx,[ebx+Object.FigCount]
  350.         jecxz .cycle4end
  351.         mov edi,[ebx+Object.FigData]
  352.         ;copy first min X
  353.         mov eax,[edi]
  354.         fld qword[eax+Figure.MinX]
  355.         fadd qword[eax+Figure.SizeX]
  356.         fstp qword[ebx+Object.SizeX]
  357.         dec ecx
  358.         jecxz .cycle4end
  359. align 4
  360.         .cycle4:
  361.                 add edi,4
  362.                 mov eax,[edi]
  363.                 or eax,eax
  364.                 jz @f
  365.                 cmp [eax+Figure.PoiCount],0
  366.                 je @f
  367.                 fld qword[eax+Figure.MinX]
  368.                 fadd qword[eax+Figure.SizeX]
  369.                 fcomp qword[ebx+Object.SizeX]
  370.                 fstsw ax
  371.                 sahf
  372.                 jbe @f
  373.                         mov eax,[edi]
  374.                         fld qword[eax+Figure.MinX]
  375.                         fadd qword[eax+Figure.SizeX]
  376.                         fstp qword[ebx+Object.SizeX]
  377.                 @@:
  378.         loop .cycle4
  379.         .cycle4end:
  380.  
  381.         ;found max coord Y
  382.         mov ecx,[ebx+Object.FigCount]
  383.         jecxz .cycle5end
  384.         mov edi,[ebx+Object.FigData]
  385.         ;copy first min Y
  386.         mov eax,[edi]
  387.         fld qword[eax+Figure.MinY]
  388.         fadd qword[eax+Figure.SizeY]
  389.         fstp qword[ebx+Object.SizeY]
  390.         dec ecx
  391.         jecxz .cycle5end
  392. align 4
  393.         .cycle5:
  394.                 add edi,4
  395.                 mov eax,[edi]
  396.                 or eax,eax
  397.                 jz @f
  398.                 cmp [eax+Figure.PoiCount],0
  399.                 je @f
  400.                 fld qword[eax+Figure.MinY]
  401.                 fadd qword[eax+Figure.SizeY]
  402.                 fcomp qword[ebx+Object.SizeY]
  403.                 fstsw ax
  404.                 sahf
  405.                 jbe @f
  406.                         mov eax,[edi]
  407.                         fld qword[eax+Figure.MinY]
  408.                         fadd qword[eax+Figure.SizeY]
  409.                         fstp qword[ebx+Object.SizeY]
  410.                 @@:
  411.         loop .cycle5
  412.         .cycle5end:
  413.  
  414.         ;found size X
  415.         fld qword[ebx+Object.SizeX]
  416.         fsub qword[ebx+Object.MinX]
  417.         fstp qword[ebx+Object.SizeX]
  418.         ;found size Y
  419.         fld qword[ebx+Object.SizeY]
  420.         fsub qword[ebx+Object.MinY]
  421.         fstp qword[ebx+Object.SizeY]
  422.  
  423.         ;*** Calculate scale ***
  424.                 fld1
  425.                 fstp qword[ebx+Object.WScale] ;set default scale
  426.  
  427.                 fld qword[ebx+Object.SizeX]
  428.                 ftst
  429.                 fstsw ax
  430.                 sahf
  431.                 jne .els_0 ;if (SizeX == 0.0)
  432.                         ffree st0
  433.                         fincstp
  434.                         jmp .els_1
  435.                 .els_0: ;else if (SizeX != 0.0)
  436.                         fild dword[buf_0.w]
  437.                         fisub dword[graf_margin_left]
  438.                         fisub dword[graf_margin_right]
  439.                         fxch st1
  440.                         fdivp
  441.                         fstp qword[ebx+Object.WScale]
  442.                 .els_1:
  443.  
  444.                 fld qword[ebx+Object.SizeY]
  445.                 ftst
  446.                 fstsw ax
  447.                 sahf
  448.                 jne .els_2 ;if (SizeY == 0.0)
  449.                         ffree st0
  450.                         fincstp
  451.                         jmp .els_3
  452.                 .els_2: ;else if (SizeY != 0.0)
  453.                         fild dword[buf_0.h]
  454.                         fisub dword[graf_margin_top]
  455.                         fisub dword[graf_margin_bot]
  456.                         fxch st1
  457.                         fdivp
  458.                         fcom qword[ebx+Object.WScale]
  459.                         fstsw ax
  460.                         sahf
  461.                         jbe @f
  462.                                 ffree st0
  463.                                 fincstp
  464.                                 jmp .els_3
  465.                         @@:
  466.                         fstp qword[ebx+Object.WScale]
  467.                 .els_3:
  468.  
  469.                 fld1
  470.                 fstp qword[ebx+Figure.MScale]
  471.                 mov dword[ebx+Figure.MCentrX],0
  472.                 mov dword[ebx+Figure.MCentrY],0
  473.         ret
  474. endp
  475.  
  476. ;input:
  477. ; esi - input description text
  478. ; pfig - pointer to figure struct
  479. ;output:
  480. ; esi - output description text
  481. align 4
  482. proc FigureInit uses eax ebx ecx edx edi, pfig:dword
  483.         mov ebx,FigData ; temp struct
  484.         mov [ebx+Figure.OType],'Fig'
  485.         mov edi,ebx
  486.         add edi,Figure.Caption
  487.         stdcall txt_load_line,32
  488.                
  489.         xor eax,eax
  490.         mov [ebx+Figure.PoiCount],eax
  491.         mov [ebx+Figure.PoiData],eax
  492.         cmp byte[esi],'X'
  493.         jne .end0
  494.                 stdcall get_max_points
  495.                 mov [ebx+Figure.PoiCount],eax
  496.                 or eax,eax
  497.                 jz .end0
  498.                 mov ecx,eax
  499.                 imul eax,sizeof.Point
  500.                 stdcall mem.Alloc,eax
  501.                 mov [ebx+Figure.PoiData],eax
  502.                 or eax,eax
  503.                 jz .err_init
  504.                 mov edi,eax
  505. align 4
  506.                 .cycle0:
  507.                         stdcall PointInit,edi
  508.                         or eax,eax
  509.                         jz .cycle0end
  510.                         add edi,sizeof.Point
  511.                         loop .cycle0
  512.                 .cycle0end:
  513.                 or ecx,ecx
  514.                 jz .end1
  515.                         ;㬥­ìè ¥¬ ®¡ê¥¬ ¯ ¬ï⨠¢ë¤¥«¥­­ë© ¤«ï â®ç¥ª
  516.                         sub [ebx+Figure.PoiCount],ecx
  517.                         mov eax,[ebx+Figure.PoiCount]
  518.                         imul eax,sizeof.Point
  519.                         stdcall mem.ReAlloc,[ebx+Figure.PoiData],eax
  520.                         mov [ebx+Figure.PoiData],eax
  521.                 jmp .end1
  522.         .err_init:
  523.                 notify_window_run txt_err_2
  524.         .end0:
  525.                 ;command
  526.                 stdcall txt_next_line, 80
  527.                 cmp byte[esi],13
  528.                 jne @f
  529.                         ;if null line
  530.                         inc esi
  531.                         cmp byte[esi],10
  532.                         jne .end2
  533.                                 inc esi
  534.                         .end2:
  535.                         mov dword[edi],(10 shl 8)+13 ;new line
  536.                 @@:
  537.                 stdcall add_object_in_list,ebx,[pfig]
  538.                 jmp .end_f
  539.         .end1:
  540.                 ;coords
  541.                 stdcall add_object_in_list,ebx,[pfig]
  542.                 or eax,eax
  543.                 jz .end_f
  544.                 stdcall FigCalculateSizes,eax,1
  545.         .end_f:
  546.         ret
  547. endp
  548.  
  549. ;input:
  550. ; esi - pointer to file
  551. ;output:
  552. ; eax - max lines in file
  553. align 4
  554. proc get_max_lines uses esi
  555.         xor eax,eax
  556.         .cycle0:
  557.                 cmp byte[esi],13
  558.                 jne @f
  559.                         inc eax
  560.                 @@:
  561.                 inc esi
  562.                 cmp byte[esi],0
  563.                 jne .cycle0
  564.         ret
  565. endp
  566.  
  567. ;input:
  568. ; esi - pointer to file
  569. ;output:
  570. ; eax - max point coords in file
  571. align 4
  572. proc get_max_points uses esi
  573.         xor eax,eax
  574.         .cycle0:
  575.                 cmp word[esi],' Y'
  576.                 jne @f
  577.                         inc eax
  578.                 @@:
  579.                 inc esi
  580.                 cmp byte[esi+1],0
  581.                 jne .cycle0
  582.         ret
  583. endp
  584.  
  585. ;input:
  586. ; opt_calc - ¥á«¨ 0 - ¯¥à¥áç¨â âì ¬ áèâ ¡ 䨣ãàë,
  587. ;                 1 - ¯¥à¥áç¨â âì à §¬¥àë ¨ ¬ áèâ ¡ 䨣ãàë
  588. align 4
  589. proc FigCalculateSizes uses eax ebx ecx edi esi, pfig:dword, opt_calc:dword
  590.         mov ebx,[pfig]
  591.         or ebx,ebx
  592.         jz .end_f
  593.  
  594.         finit
  595.         bt dword[opt_calc],0
  596.         jnc .calc_scale
  597.  
  598.         ;*** Calculate sizes ***
  599.         mov esi,[ebx+Figure.PoiData]
  600.         or esi,esi
  601.         jz .end_f
  602.  
  603.         lea esi,[esi+Point.CoordX]
  604.         lea edi,[ebx+Figure.MinX]
  605.         movsd
  606.         movsd ;Figure.MinX = Point[0].CoordX
  607.         sub esi,8
  608.         lea edi,[ebx+Figure.SizeX]
  609.         movsd
  610.         movsd ;Figure.SizeX = Point[0].CoordX
  611.         mov esi,[ebx+Figure.PoiData]
  612.         lea esi,[esi+Point.CoordY]
  613.         lea edi,[ebx+Figure.MinY]
  614.         movsd
  615.         movsd ;Figure.MinY = Point[0].CoordY
  616.         sub esi,8
  617.         lea edi,[ebx+Figure.SizeY]
  618.         movsd
  619.         movsd ;Figure.SizeY = Point[0].CoordY
  620.  
  621.         ;found min coord X
  622.         mov ecx,[ebx+Figure.PoiCount]
  623.         jecxz .cycle2end
  624.         mov edi,[ebx+Figure.PoiData]
  625. align 4
  626.         .cycle2:
  627.                 fld qword[edi+Point.CoordX]
  628.                 fcomp qword[ebx+Figure.MinX]
  629.                 fstsw ax
  630.                 sahf
  631.                 ja @f
  632.                         push edi esi
  633.                         lea esi,[edi+Point.CoordX]
  634.                         lea edi,[ebx+Figure.MinX]
  635.                         movsd
  636.                         movsd
  637.                         pop esi edi
  638.                 @@:
  639.                 add edi,sizeof.Point
  640.         loop .cycle2
  641.         .cycle2end:
  642.  
  643.         ;found min coord Y
  644.         mov ecx,[ebx+Figure.PoiCount]
  645.         jecxz .cycle3end
  646.         mov edi,[ebx+Figure.PoiData]
  647. align 4
  648.         .cycle3:
  649.                 fld qword[edi+Point.CoordY]
  650.                 fcomp qword[ebx+Figure.MinY]
  651.                 fstsw ax
  652.                 sahf
  653.                 ja @f
  654.                         push edi esi
  655.                         lea esi,[edi+Point.CoordY]
  656.                         lea edi,[ebx+Figure.MinY]
  657.                         movsd
  658.                         movsd
  659.                         pop esi edi
  660.                 @@:
  661.                 add edi,sizeof.Point
  662.         loop .cycle3
  663.         .cycle3end:
  664.  
  665.         ;found max coord X
  666.         mov ecx,[ebx+Figure.PoiCount]
  667.         jecxz .cycle4end
  668.         mov edi,[ebx+Figure.PoiData]
  669. align 4
  670.         .cycle4:
  671.                 fld qword[edi+Point.CoordX]
  672.                 fcomp qword[ebx+Figure.SizeX]
  673.                 fstsw ax
  674.                 sahf
  675.                 jbe @f
  676.                         push edi esi
  677.                         lea esi,[edi+Point.CoordX]
  678.                         lea edi,[ebx+Figure.SizeX]
  679.                         movsd
  680.                         movsd
  681.                         pop esi edi
  682.                 @@:
  683.                 add edi,sizeof.Point
  684.         loop .cycle4
  685.         .cycle4end:
  686.  
  687.         ;found max coord Y
  688.         mov ecx,[ebx+Figure.PoiCount]
  689.         jecxz .cycle5end
  690.         mov edi,[ebx+Figure.PoiData]
  691. align 4
  692.         .cycle5:
  693.                 fld qword[edi+Point.CoordY]
  694.                 fcomp qword[ebx+Figure.SizeY]
  695.                 fstsw ax
  696.                 sahf
  697.                 jbe @f
  698.                         push edi esi
  699.                         lea esi,[edi+Point.CoordY]
  700.                         lea edi,[ebx+Figure.SizeY]
  701.                         movsd
  702.                         movsd
  703.                         pop esi edi
  704.                 @@:
  705.                 add edi,sizeof.Point
  706.         loop .cycle5
  707.         .cycle5end:
  708.  
  709.         ;found size X
  710.         fld qword[ebx+Figure.SizeX]
  711.         fsub qword[ebx+Figure.MinX]
  712.         fstp qword[ebx+Figure.SizeX]
  713.         ;found size Y
  714.         fld qword[ebx+Figure.SizeY]
  715.         fsub qword[ebx+Figure.MinY]
  716.         fstp qword[ebx+Figure.SizeY]
  717.                
  718.         ;*** Calculate scale ***
  719. align 4
  720.         .calc_scale:
  721.         mov dword[ebx+Figure.MCentrX],0
  722.         mov dword[ebx+Figure.MCentrY],0
  723.         fld1
  724.         fst qword[ebx+Figure.MScale] ;???
  725.         fstp qword[ebx+Figure.WScale] ;set default scale
  726.  
  727.         fld qword[ebx+Figure.SizeX]
  728.         ftst
  729.         fstsw ax
  730.         sahf
  731.         jne .els_0 ;if (SizeX == 0.0)
  732.                 ffree st0
  733.                 fincstp
  734.                 jmp .els_1
  735.         .els_0: ;else if (SizeX != 0.0)
  736.                 fild dword[buf_0.w]
  737.                 fisub dword[graf_margin_left]
  738.                 fisub dword[graf_margin_right]
  739.                 fxch st1
  740.                 fdivp
  741.                 fstp qword[ebx+Figure.WScale]
  742.         .els_1:
  743.  
  744.         fld qword[ebx+Figure.SizeY]
  745.         ftst
  746.         fstsw ax
  747.         sahf
  748.         jne .els_2 ;if (SizeY == 0.0)
  749.                 ffree st0
  750.                 fincstp
  751.                 jmp .els_3
  752.         .els_2: ;else if (SizeY != 0.0)
  753.                 fild dword[buf_0.h]
  754.                 fisub dword[graf_margin_top]
  755.                 fisub dword[graf_margin_bot]
  756.                 fxch st1
  757.                 fdivp
  758.                 fcom qword[ebx+Figure.WScale]
  759.                 fstsw ax
  760.                 sahf
  761.                 jbe @f
  762.                         ffree st0
  763.                         fincstp
  764.                         jmp .els_3
  765.                 @@:
  766.                 fstp qword[ebx+Figure.WScale]
  767.         .els_3:
  768.  
  769.         .end_f:
  770.         ret
  771. endp
  772.  
  773. ;input:
  774. ; esi - input description text
  775. ; ppoi - pointer to point struct
  776. ;output:
  777. ; eax - 0 (if error init) or 1
  778. ; esi - output description text
  779. align 4
  780. proc PointInit uses ebx ecx edi, ppoi:dword
  781.         mov     ecx,64 ;§ é¨â  ®â § æ¨ª«¨¢ ­¨ï
  782.         @@:
  783.                 lodsb
  784.                 cmp     al,' '
  785.                 jne     @f
  786.                 loop @b
  787.         @@:
  788.         dec esi
  789.         cmp byte[esi],'X'
  790.         jne .err_init
  791.                 inc esi
  792.                 stdcall conv_str_to_int, esi
  793.                 mov ebx,[ppoi]
  794.  
  795.                 ;Data_String <- esi
  796.                 push esi
  797.                         mov ecx,32
  798.                         mov edi,esi
  799.                         @@:
  800.                                 lodsb
  801.                                 or al,al
  802.                                 jz @f
  803.                                 cmp al,' '
  804.                                 je @f
  805.                                 cmp al,13
  806.                                 je @f
  807.                                 loop @b
  808.                         @@:
  809.                         mov esi,edi
  810.                         sub ecx,32
  811.                         neg ecx
  812.                         mov edi,Data_String
  813.                         rep movsb
  814.                         mov byte[edi],0
  815.                 pop esi
  816.                 stdcall String_to_DoubleFloat
  817.                 ;Data_Double -> Point.CoordX
  818.                 push esi
  819.                         mov esi,Data_Double
  820.                         lea edi,[ebx+Point.CoordX]
  821.                         movsd
  822.                         movsd
  823.                 pop esi
  824.  
  825.                 push edi
  826.                 mov al,'Y'
  827.                 mov ecx,80
  828.                 mov edi,esi
  829.                 repne scasb
  830.                 mov esi,edi
  831.                 pop edi
  832.                 ;Data_String <- esi
  833.                 push esi
  834.                         mov ecx,32
  835.                         mov edi,esi
  836.                         @@:
  837.                                 lodsb
  838.                                 or al,al
  839.                                 jz @f
  840.                                 cmp al,' '
  841.                                 je @f
  842.                                 cmp al,13
  843.                                 je @f
  844.                                 loop @b
  845.                         @@:
  846.                         mov esi,edi
  847.                         sub ecx,32
  848.                         neg ecx
  849.                         mov edi,Data_String
  850.                         rep movsb
  851.                         mov byte[edi],0
  852.                 pop esi
  853.                 stdcall String_to_DoubleFloat
  854.                 ;Data_Double -> Point.CoordY
  855.                 push esi
  856.                         mov esi,Data_Double
  857.                         lea edi,[ebx+Point.CoordY]
  858.                         movsd
  859.                         movsd
  860.                 pop esi
  861.  
  862.                 stdcall txt_next_line, 80
  863.                 jmp @f
  864.         .err_init:
  865.                 xor eax,eax
  866.                 jmp .end_f
  867.         @@:
  868.                 xor eax,eax
  869.                 inc eax
  870.         .end_f:
  871.         ret
  872. endp
  873.  
  874. ;input:
  875. ; buffer - ¤®¡ ¢«ï¥¬ë¥ ¤ ­­ë¥
  876. ; pfig - 㪠§ â¥«ì ­  ¤®¡ ¢«¥­­ãî 䨣ãàã (¤«ï ª®­â஫ï á® áâ®à®­ë த¨â¥«ì᪮£® ®¡ê¥ªâ )
  877. ;output:
  878. ; eax - object data pointer
  879. align 4
  880. proc add_object_in_list uses ebx ecx edi esi, buffer:dword, pfig:dword
  881.         mov ebx,[pfig]
  882.         or ebx,ebx
  883.         jz @f
  884.                 stdcall mem.Alloc,sizeof.Figure
  885.                 mov [ebx],eax
  886.                 mov ecx,sizeof.Figure
  887.                 mov edi,eax
  888.                 mov esi,[buffer]
  889.                 rep movsb
  890.         @@:
  891.         ret
  892. endp
  893.  
  894. ;description:
  895. ; äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï ¢ë¡à ­­®£® ®¡ê¥ªâ 
  896. align 4
  897. proc draw_obj2d, pobj:dword
  898. locals
  899.         CentrX dd ?
  900.         CentrY dd ?
  901. endl
  902. pushad
  903.         mov ebx,[pobj]
  904.         stdcall [buf2d_clear], buf_0, [buf_0.color]
  905.         mov ecx,[ebx+Object.FigCount]
  906.         or ecx,ecx
  907.         jz .end_f
  908.         ;;jecxz .end_f
  909.                 mov edi,[ebx+Object.FigData]
  910.                 finit
  911.                 fld qword[ebx+Object.SizeY]
  912.                 fmul qword[ebx+Object.WScale]
  913.                 fmul qword[ebx+Object.MScale]
  914.                 fchs
  915.                 fistp dword[CentrY]
  916.                 mov eax,[CentrY]
  917.                 sub eax,[graf_margin_top]
  918.                 sub eax,[graf_margin_bot]
  919.                 add eax,[buf_0.h]
  920.                 sar eax,1
  921.                 add eax,[graf_margin_bot] ;_bot   ­¥ _top - ¢ á¢ï§¨ á ⥬ çâ® ª®®à¤. Y ¯¥à¥¢¥à­ãâ 
  922.                 add eax,[ebx+Object.MCentrY]
  923.                 mov [CentrY],eax
  924.                 fld qword[ebx+Object.SizeX]
  925.                 fmul qword[ebx+Object.WScale]
  926.                 fmul qword[ebx+Object.MScale]
  927.                 fchs
  928.                 fistp dword[CentrX]
  929.                 mov edx,[CentrX]
  930.                 sub edx,[graf_margin_left]
  931.                 sub edx,[graf_margin_right]
  932.                 add edx,[buf_0.w]
  933.                 sar edx,1
  934.                 add edx,[graf_margin_left]
  935.                 add edx,[ebx+Object.MCentrX]
  936.                 mov [CentrX],edx
  937. align 4
  938.                 .cycle0:
  939.                         stdcall draw_fig2d_litl, buf_0,ebx,[edi],0,edx,eax
  940.                         add edi,4
  941.                         loop .cycle0
  942.                 stdcall [buf2d_flip_v], buf_0
  943.  
  944.         bt dword[opt_draw],0
  945.         jnc .end_f
  946.                 ; draw min & sizes
  947.                 mov word[NumberSymbolsAD],8
  948.                 stdcall mem_copy, txt_buf,txt_size_x,20
  949.                 fld qword[ebx+Object.SizeX]
  950.                 fstp qword[Data_Double]
  951.                 call DoubleFloat_to_String
  952.                 call String_crop_0
  953.                 stdcall str_cat,txt_buf,Data_String
  954.                 stdcall str_cat,txt_buf,txt_n
  955.                 stdcall str_cat,txt_buf,txt_size_y
  956.                 fld qword[ebx+Object.SizeY]
  957.                 fstp qword[Data_Double]
  958.                 call DoubleFloat_to_String
  959.                 call String_crop_0
  960.                 stdcall str_cat,txt_buf,Data_String
  961.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,23,0
  962.  
  963.                 fld qword[ebx+Object.MinX]
  964.                 fstp qword[Data_Double]
  965.                 stdcall mem_copy, txt_buf,txt_min_x,20
  966.                 call DoubleFloat_to_String
  967.                 call String_crop_0
  968.                 stdcall str_cat,txt_buf,Data_String
  969.                 stdcall str_cat,txt_buf,txt_n
  970.                 stdcall str_cat,txt_buf,txt_min_y
  971.                 fld qword[ebx+Object.MinY]
  972.                 fstp qword[Data_Double]
  973.                 call DoubleFloat_to_String
  974.                 call String_crop_0
  975.                 stdcall str_cat,txt_buf,Data_String
  976.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,3,0
  977.         .end_f:
  978. popad
  979.         ret
  980. endp
  981.  
  982. ;input:
  983. ; pbuf - pointer to buffer 2d
  984. ;description:
  985. ; äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï ®¡ê¥ªâ  ¯® ç áâï¬
  986. align 4
  987. proc draw_fig2d_litl, pbuf:dword, pobj:dword, pfig:dword, Scale:dword, CentrX:dword, CentrY:dword
  988. locals
  989.         PervX dd 0 ;pervios point coord X
  990.         PervY dd 0 ;pervios point coord Y
  991.         GrafX dd ? ;active point coord X
  992.         GrafY dd ? ;active point coord Y
  993. endl
  994. pushad
  995.         mov ebx,[pfig]
  996.         test ebx,ebx
  997.         jz .end_f
  998.         mov ecx,[ebx+Figure.PoiCount]
  999.         ;;jecxz .end_f
  1000.         test ecx,ecx
  1001.         jz .end_f
  1002.         mov edi,[ebx+Figure.PoiData]
  1003.         mov edx,[pobj]
  1004.  
  1005.         fld1
  1006.         mov eax,[Scale]
  1007.         or eax,eax
  1008.         jnz @f
  1009.                 lea eax,[edx+Object.MScale]
  1010.                 fmul qword[eax]
  1011.                 lea eax,[edx+Object.WScale]
  1012.         @@:
  1013.         fmul qword[eax]
  1014. align 4
  1015.         .cycle0:
  1016.                 fld qword[edi+Point.CoordX]
  1017.                 fsub qword[edx+Object.MinX]
  1018.                 fmul st0,st1
  1019.                 fiadd dword[CentrX]
  1020.                 fistp dword[ebp-8]
  1021.                 fld qword[edi+Point.CoordY]
  1022.                 fsub qword[edx+Object.MinY]
  1023.                 fmul st0,st1
  1024.                 fiadd dword[CentrY]
  1025.                 fistp dword[ebp-4]
  1026.                 stdcall [buf2d_set_pixel], [pbuf], [GrafX],[GrafY], 0xff0000
  1027.                 cmp ecx,[ebx+Figure.PoiCount]
  1028.                 je @f
  1029.                         stdcall [buf2d_line_sm], [pbuf], [PervX],[PervY], [GrafX],[GrafY], 0x80
  1030.                         ;sub esp,24
  1031.                         ;call [buf2d_line]
  1032.                         stdcall [buf2d_line], [pbuf], [PervX],[PervY], [GrafX],[GrafY], 0x80
  1033.                 @@:
  1034.                 mov eax,[GrafX]
  1035.                 mov [PervX],eax
  1036.                 mov eax,[GrafY]
  1037.                 mov [PervY],eax
  1038.                 add edi,sizeof.Point
  1039.         ;;loop .cycle0
  1040.                 dec ecx
  1041.         jnz .cycle0
  1042.         ffree st0
  1043.         fincstp
  1044.  
  1045.         .end_f:
  1046. popad
  1047.         ret
  1048. endp
  1049.  
  1050. ;description:
  1051. ; äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï ¢ë¡à ­­®© 䨣ãàë
  1052. align 4
  1053. proc draw_fig2d, pfig:dword
  1054. locals
  1055.         n dd 0
  1056.         col_lin dd 0 ;梥⠫¨­¨© 䨣ãàë
  1057.         CentrX dd ?
  1058.         CentrY dd ?
  1059.         PervX dd 0 ;pervios point coord X
  1060.         PervY dd 0 ;pervios point coord Y
  1061.         GrafX dd ? ;active point coord X
  1062.         GrafY dd ? ;active point coord Y
  1063.         old_tl dd 0 ;old text coord X0
  1064.         old_tt dd 0 ;old text coord Y0
  1065.         old_tw dd 0 ;old text coord X1
  1066.         old_th dd 0 ;old text coord Y1
  1067.         new_tl dd 0 ;new text coord X0
  1068.         ;new_tt dd 0 ;new text coord Y0
  1069.         new_tw dd 0 ;new text coord X1
  1070.         ;new_th dd 0 ;new text coord Y1
  1071. endl
  1072. pushad
  1073.         stdcall [buf2d_clear], buf_0, [buf_0.color]
  1074.         mov ebx,[pfig]
  1075.         test ebx,ebx
  1076.         jz .end_f
  1077.         mov ecx,[ebx+Figure.PoiCount]
  1078.         ;;jecxz .end_f
  1079.         test ecx,ecx
  1080.         jz .end_f
  1081.         mov edi,[ebx+Figure.PoiData]
  1082.         finit
  1083.         fld qword[ebx+Figure.SizeY]
  1084.         fmul qword[ebx+Figure.WScale]
  1085.         fmul qword[ebx+Figure.MScale]
  1086.         fchs
  1087.         fistp dword[CentrY]
  1088.         mov eax,[CentrY]
  1089.         sub eax,[graf_margin_top]
  1090.         sub eax,[graf_margin_bot]
  1091.         add eax,[buf_0.h]
  1092.         sar eax,1
  1093.         add eax,[graf_margin_bot]
  1094.         add eax,[ebx+Figure.MCentrY]
  1095.         mov [CentrY],eax
  1096.         ;CentrY = (-(Figure.SizeY * Figure.WScale) - graf_margin_top - graf_margin_bot + buf_0.h) / 2 + graf_margin_bot
  1097.         fld qword[ebx+Figure.SizeX]
  1098.         fmul qword[ebx+Figure.WScale]
  1099.         fmul qword[ebx+Figure.MScale]
  1100.         fchs
  1101.         fistp dword[CentrX]
  1102.         mov eax,[CentrX]
  1103.         sub eax,[graf_margin_left]
  1104.         sub eax,[graf_margin_right]
  1105.         add eax,[buf_0.w]
  1106.         sar eax,1
  1107.         add eax,[graf_margin_left]
  1108.         add eax,[ebx+Figure.MCentrX]
  1109.         mov [CentrX],eax        
  1110.         ;CentrX = (-(Figure.SizeX * Figure.WScale) - graf_margin_left - graf_margin_right + buf_0.w) / 2 + graf_margin_left
  1111.  
  1112. align 4
  1113.         .cycle0:
  1114.                 fld qword[edi+Point.CoordX]
  1115.                 fsub qword[ebx+Figure.MinX]
  1116.                 fmul qword[ebx+Figure.WScale]
  1117.                 fmul qword[ebx+Figure.MScale]
  1118.                 fiadd dword[CentrX]
  1119.                 fistp dword[GrafX]
  1120.                 ;GrafX = (Point.CoordX - Figure.MinX) * Figure.WScale + CentrX
  1121.                 fld qword[edi+Point.CoordY]
  1122.                 fsub qword[ebx+Figure.MinY]
  1123.                 fmul qword[ebx+Figure.WScale]
  1124.                 fmul qword[ebx+Figure.MScale]
  1125.                 fiadd dword[CentrY]
  1126.                 fisub dword[buf_0.h] ;invert coord Y
  1127.                 fchs
  1128.                 fistp dword[GrafY]
  1129.                 ;GrafY = -((Point.CoordY - Figure.MinY) * Figure.WScale + CentrY - buf_0.h)
  1130.  
  1131.                 stdcall [buf2d_set_pixel], buf_0, [GrafX],[GrafY], 0xff0000
  1132.                 mov dword[col_lin],0x80
  1133.                 cmp ecx,[ebx+Figure.PoiCount]
  1134.                 je @f
  1135.                         stdcall [buf2d_line_sm], buf_0, [PervX],[PervY], [GrafX],[GrafY], [col_lin]
  1136.                         stdcall [buf2d_line], buf_0, [PervX],[PervY], [GrafX],[GrafY], [col_lin]
  1137.                 @@:
  1138.                 mov eax,[GrafX]
  1139.                 mov [PervX],eax
  1140.                 mov edx,[GrafY]
  1141.                 mov [PervY],edx
  1142.                 add edi,sizeof.Point
  1143.  
  1144.                 bt dword[opt_draw],0
  1145.                 jnc .end0
  1146.                 ; draw number points
  1147.                 ;mov eax,[GrafX]
  1148.                 ;mov edx,[GrafY]
  1149.                 add eax,2
  1150.                 add edx,2
  1151.                 push eax edi
  1152.                         mov eax,[n]
  1153.                         mov edi,txt_buf
  1154.                         stdcall convert_int_to_str,20
  1155.                 pop edi eax
  1156.  
  1157.                 inc dword[n]
  1158.                 ;calculate new text coords
  1159.                 mov [new_tl],eax
  1160.                 mov esi,eax
  1161.                 stdcall str_len,txt_buf
  1162.                 imul eax,[buf_1.w]
  1163.                 add eax,esi
  1164.                 mov [new_tw],eax
  1165.                 ;rect compare coords
  1166.                 cmp [old_tl],eax
  1167.                 jg .no_comp
  1168.                 cmp [old_tw],esi
  1169.                 jl .no_comp
  1170.                         ;calculate new text coord Y1
  1171.                         mov esi,edx
  1172.                         add esi,[font_h]
  1173.                 cmp [old_tt],esi
  1174.                 jg .no_comp
  1175.                 cmp [old_th],edx
  1176.                 ;jl .no_comp
  1177.                         ;jmp .end0
  1178.                 jge .end0
  1179.                 .no_comp:
  1180.                         mov eax,[new_tl]
  1181.                         mov [old_tl],eax
  1182.                         mov eax,[new_tw]
  1183.                         mov [old_tw],eax
  1184.                         mov [old_tt],edx
  1185.                         add edx,[font_h]
  1186.                         mov [old_th],edx
  1187.                         stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,[old_tl],[old_tt],0x000000
  1188.                 .end0:
  1189.                 dec ecx
  1190.         jnz .cycle0
  1191.  
  1192.         bt dword[opt_draw],0
  1193.         jnc .end_f
  1194.                 ; draw min & sizes
  1195.                 mov word[NumberSymbolsAD],8
  1196.                 stdcall mem_copy, txt_buf,txt_size_x,20
  1197.                 fld qword[ebx+Figure.SizeX]
  1198.                 fstp qword[Data_Double]
  1199.                 call DoubleFloat_to_String
  1200.                 call String_crop_0
  1201.                 stdcall str_cat,txt_buf,Data_String
  1202.                 stdcall str_cat,txt_buf,txt_n
  1203.                 stdcall str_cat,txt_buf,txt_size_y
  1204.                 fld qword[ebx+Figure.SizeY]
  1205.                 fstp qword[Data_Double]
  1206.                 call DoubleFloat_to_String
  1207.                 call String_crop_0
  1208.                 stdcall str_cat,txt_buf,Data_String
  1209.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,23,0
  1210.  
  1211.                 fld qword[ebx+Figure.MinX]
  1212.                 fstp qword[Data_Double]
  1213.                 stdcall mem_copy, txt_buf,txt_min_x,20
  1214.                 call DoubleFloat_to_String
  1215.                 call String_crop_0
  1216.                 stdcall str_cat,txt_buf,Data_String
  1217.                 stdcall str_cat,txt_buf,txt_n
  1218.                 stdcall str_cat,txt_buf,txt_min_y
  1219.                 fld qword[ebx+Figure.MinY]
  1220.                 fstp qword[Data_Double]
  1221.                 call DoubleFloat_to_String
  1222.                 call String_crop_0
  1223.                 stdcall str_cat,txt_buf,Data_String
  1224.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,3,0
  1225.         .end_f:
  1226. popad
  1227.         ret
  1228. endp
  1229.  
  1230. align 4
  1231. proc mouse_left_d uses eax ebx
  1232.         call buf_get_mouse_coord
  1233.         cmp eax,-1
  1234.         je .end_f
  1235.                 mov [mouse_down_x],eax
  1236.                 mov [mouse_down_y],ebx
  1237.         .end_f:
  1238.         ret
  1239. endp
  1240.  
  1241. align 4
  1242. proc mouse_left_u uses eax ebx ecx
  1243.         call buf_get_mouse_coord
  1244.         cmp eax,-1
  1245.         je .end_f
  1246.                 sub eax,[mouse_down_x]
  1247.                 sub ebx,[mouse_down_y]
  1248.                 mov ecx,ObjData
  1249.                 add [ecx+Figure.MCentrX],eax
  1250.                 sub [ecx+Figure.MCentrY],ebx
  1251.                 mov dword[offs_last_timer],0
  1252.         .end_f:
  1253.         ret
  1254. endp
  1255.